diff --git a/2018/11/11/hadoop-native/2.7.7/Linux-x64/hadoop-2.7.7-native-c7.tar.gz b/2018/11/11/hadoop-native/2.7.7/Linux-x64/hadoop-2.7.7-native-c7.tar.gz new file mode 100644 index 00000000..25c7ba0a Binary files /dev/null and b/2018/11/11/hadoop-native/2.7.7/Linux-x64/hadoop-2.7.7-native-c7.tar.gz differ diff --git a/2018/11/11/hadoop-native/2.8.5/Linux-x64/hadoop-2.8.5-native-c7.tar.gz b/2018/11/11/hadoop-native/2.8.5/Linux-x64/hadoop-2.8.5-native-c7.tar.gz new file mode 100644 index 00000000..9336c20b Binary files /dev/null and b/2018/11/11/hadoop-native/2.8.5/Linux-x64/hadoop-2.8.5-native-c7.tar.gz differ diff --git a/2018/11/11/hadoop-native/2.9.1/Linux-x64/hadoop-2.9.1-native-c7.tar.gz b/2018/11/11/hadoop-native/2.9.1/Linux-x64/hadoop-2.9.1-native-c7.tar.gz new file mode 100644 index 00000000..0b7a5f64 Binary files /dev/null and b/2018/11/11/hadoop-native/2.9.1/Linux-x64/hadoop-2.9.1-native-c7.tar.gz differ diff --git a/2018/11/11/hadoop-native/3.0.3/Linux-x64/hadoop-3.0.3-native-c7.tar.gz b/2018/11/11/hadoop-native/3.0.3/Linux-x64/hadoop-3.0.3-native-c7.tar.gz new file mode 100644 index 00000000..b5aa2fe9 Binary files /dev/null and b/2018/11/11/hadoop-native/3.0.3/Linux-x64/hadoop-3.0.3-native-c7.tar.gz differ diff --git a/2018/11/11/hadoop-native/3.0.3/Windows-x64/hadoop.dll b/2018/11/11/hadoop-native/3.0.3/Windows-x64/hadoop.dll new file mode 100644 index 00000000..fb800e21 Binary files /dev/null and b/2018/11/11/hadoop-native/3.0.3/Windows-x64/hadoop.dll differ diff --git a/2018/11/11/hadoop-native/3.0.3/Windows-x64/winutils.exe b/2018/11/11/hadoop-native/3.0.3/Windows-x64/winutils.exe new file mode 100644 index 00000000..ba60dc7d Binary files /dev/null and b/2018/11/11/hadoop-native/3.0.3/Windows-x64/winutils.exe differ diff --git a/2018/11/11/hadoop-native/3.1.1/Linux-x64/hadoop-3.1.1-native-c7.tar.gz b/2018/11/11/hadoop-native/3.1.1/Linux-x64/hadoop-3.1.1-native-c7.tar.gz new file mode 100644 index 00000000..94f60b8e Binary files /dev/null and b/2018/11/11/hadoop-native/3.1.1/Linux-x64/hadoop-3.1.1-native-c7.tar.gz differ diff --git a/2018/11/11/hadoop-native/3.1.1/Windows-x64/hadoop.dll b/2018/11/11/hadoop-native/3.1.1/Windows-x64/hadoop.dll new file mode 100644 index 00000000..ad8577ea Binary files /dev/null and b/2018/11/11/hadoop-native/3.1.1/Windows-x64/hadoop.dll differ diff --git a/2018/11/11/hadoop-native/3.1.1/Windows-x64/winutils.exe b/2018/11/11/hadoop-native/3.1.1/Windows-x64/winutils.exe new file mode 100644 index 00000000..b863e4ad Binary files /dev/null and b/2018/11/11/hadoop-native/3.1.1/Windows-x64/winutils.exe differ diff --git a/2018/11/11/hadoop-native/index.html b/2018/11/11/hadoop-native/index.html new file mode 100644 index 00000000..0bbcf797 --- /dev/null +++ b/2018/11/11/hadoop-native/index.html @@ -0,0 +1,231 @@ + + + + + + + + + + + + Hadoop Native | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Hadoop Native +

+ +

Linux kernel 3.10 or later

setup

yum

+

yum install -y cmake gcc-c++ protobuf-compiler

+
+
1
2
3
cmake-2.8.12.2-2.el7.x86_64
gcc-c++-4.8.5-39.el7.x86_64
protobuf-compiler-2.5.0-8.el7.x86_64
+ +

jdk 1.8 & maven 3.6

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
export JAVA_HOME=/opt/jdk-8
export PATH=/opt/jdk-8/bin:/opt/maven-3/bin:/opt/cmake-3/bin:/usr/sbin:/usr/bin:/sbin:/bin

mkdir -p /opt/jdk-8 && curl -sSL https://cdn.azul.com/zulu/bin/zulu8.44.0.11-ca-jdk8.0.242-linux_x64.tar.gz \
| tar -xvz --strip-components=1 -C /opt/jdk-8

mkdir -p /opt/maven-3 && curl -sSL http://archive.apache.org/dist/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz \
| tar -xvz --strip-components=1 -C /opt/maven-3

# mvn --version
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /opt/maven-3
Java version: 1.8.0_242, vendor: Azul Systems, Inc., runtime: /opt/jdk-8/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.19.0-8-amd64", arch: "amd64", family: "unix"
+ +

Hadoop 2.7.7

Build

1
2
3
4
5
6
7
8
mvn -Dmaven.javadoc.skip=true -Dmaven.test.skip=true -DskipTests -Pdist clean package

mvn clean
while true; do
mvn -Dmaven.javadoc.skip=true -Dmaven.test.skip=true -DskipTests package
[ $? -eq 0 ] && break;
sleep 300;
done
+ +

Binaries

    +
  • Linux-x64/hadoop-2.7.7-native-c7.tar.gz
    1
    2
    3
    4
    5
    6
    -rw-r--r-- 1 root root 1235702 Nov  3 20:53 libhadoop.a
    lrwxrwxrwx 1 root root 18 Nov 3 20:53 libhadoop.so -> libhadoop.so.1.0.0
    -rwxr-xr-x 1 root root 724424 Nov 3 20:53 libhadoop.so.1.0.0
    -rw-r--r-- 1 root root 433452 Nov 3 20:53 libhdfs.a
    lrwxrwxrwx 1 root root 16 Nov 3 20:53 libhdfs.so -> libhdfs.so.0.0.0
    -rwxr-xr-x 1 root root 272064 Nov 3 20:53 libhdfs.so.0.0.0
  • +
+

Hadoop 2.8.5

Build

1
2
3
4
5
6
7
8
mvn -Dmaven.javadoc.skip=true -Dmaven.test.skip=true -DskipTests -Pdist clean package

mvn clean
while true; do
mvn -Dmaven.javadoc.skip=true -Dmaven.test.skip=true -DskipTests package
[ $? -eq 0 ] && break;
sleep 300;
done
+ +

Binaries

+

Hadoop 3.0.3

CMake

cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
+
+

Binaries

+

Hadoop 3.1.1

CMake

cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
+
+

CMake 3.1 or higher is required. You are running version 2.8.12.2

+
mkdir -p /opt/cmake-3 && curl -sSL https://cmake.org/files/v3.16/cmake-3.16.4-Linux-x86_64.tar.gz \
+    | tar -xvz --strip-components=1 -C /opt/cmake-3
+export PATH=/opt/cmake-3/bin:$PATH
+
+

Build

1
2
3
4
5
6
7
8
mvn -Dmaven.javadoc.skip=true -Dmaven.test.skip=true -DskipTests -Pdist clean package

mvn clean
while true; do
mvn -Dmaven.javadoc.skip=true -Dmaven.test.skip=true -DskipTests package
[ $? -eq 0 ] && break;
sleep 300;
done
+ +

Binaries

+

Windows 10 1709 or later

setup

Microsoft Visual C++ 2017

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
https://github.com/protocolbuffers/protobuf/releases/download/v3.6.1/protoc-3.6.1-win32.zip
https://github.com/protocolbuffers/protobuf/releases/download/v2.5.0/protoc-2.5.0-win32.zip
https://github.com/protocolbuffers/protobuf/releases/download/v2.5.0/protobuf-2.5.0.tar.gz

https://cmake.org/files/v3.12/cmake-3.12.4-win64-x64.zip
https://aka.ms/vs/15/release/vs_enterprise.exe
http://www.apache.org/dist/maven/maven-3/3.6.0/binaries/apache-maven-3.6.0-bin.zip
http://www.apache.org/dist/ant/binaries/apache-ant-1.10.5-bin.zip

http://www.apache.org/dist/hadoop/common/hadoop-3.1.1/hadoop-3.1.1-src.tar.gz
http://www.apache.org/dist/hadoop/common/hadoop-3.0.3/hadoop-3.0.3-src.tar.gz
http://www.apache.org/dist/hadoop/common/hadoop-2.9.1/hadoop-2.9.1-src.tar.gz
http://www.apache.org/dist/hadoop/common/hadoop-2.8.5/hadoop-2.8.5-src.tar.gz
http://www.apache.org/dist/hadoop/common/hadoop-2.7.7/hadoop-2.7.7-src.tar.gz

org.apache.maven.plugin.MojoExecutionException: protoc version is 'libprotoc 2.6.1', expected version is '2.5.0'

GOROOT=C:\opt\go-1.11.2
GOPATH=C:\var\vcs\git\scratch\lang\go

C:\>cmd
Microsoft Windows [Version 10.0.17134.376]
(c) 2018 Microsoft Corporation. All rights reserved.

C:\>go version
go version go1.11.2 windows/amd64

C:\>protoc --version
libprotoc 2.5.0

C:\>cmake --version
cmake version 3.12.4
CMake suite maintained and supported by Kitware (kitware.com/cmake).

C:\>cl
Microsoft (R) C/C++ Optimizing Compiler Version 19.15.26732.1 for x64
Copyright (C) Microsoft Corporation. All rights reserved.

C:\>link
Microsoft (R) Incremental Linker Version 14.15.26732.1
Copyright (C) Microsoft Corporation. All rights reserved.
+ +
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
%comspec% /k "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvars64.bat"

SET PATH=C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.15.26726\bin\HostX64\x64;%PATH%
SET PATH=C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCPackages;%PATH%
SET PATH=C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer;%PATH%
SET PATH=C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE;%PATH%
SET PATH=C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\Tools;%PATH%
SET PATH=C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\bin\Roslyn;%PATH%
SET PATH=C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\bin;%PATH%
SET PATH=C:\Program Files (x86)\Microsoft SDKs\TypeScript\3.0;%PATH%
SET PATH=C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.7.2 Tools\x64%PATH%
SET PATH=C:\Program Files (x86)\Windows Kits\10\bin\10.0.17134.0\x64;%PATH%
SET PATH=C:\Program Files (x86)\Windows Kits\10\bin\x64;%PATH%
SET PATH=C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319;%PATH%

SET LIB=C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.15.26726\ATLMFC\lib\x64
SET LIB=C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.15.26726\lib\x64;%LIB%
SET LIB=C:\Program Files (x86)\Windows Kits\10\lib\10.0.17134.0\ucrt\x64;%LIB%
SET LIB=C:\Program Files (x86)\Windows Kits\10\lib\10.0.17134.0\um\x64;%LIB%

SET INCLUDE=C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.15.26726\ATLMFC\include
SET INCLUDE=C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.15.26726\include;%INCLUDE%
SET INCLUDE=C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt;%INCLUDE%
SET INCLUDE=C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\shared;%INCLUDE%
SET INCLUDE=C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\um;%INCLUDE%
+ +

jdk 1.8 & maven 3.6

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
SET M2_HOME=C:\opt\apache-maven-3.6.0
SET MAVEN_OPTS=-Duser.language=en -Duser.country=US -Dfile.encoding=UTF-8

C:\>java -version
java version "1.8.0_192"
Java(TM) SE Runtime Environment (build 1.8.0_192-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.192-b12, mixed mode)

C:\>ant -version
Apache Ant(TM) version 1.10.5 compiled on July 10 2018

C:\>mvn --version
Apache Maven 3.6.0 (97c98ec64a1fdfee7767ce5ffb20918da4f719f3; 2018-10-25T02:41:47+08:00)
Maven home: C:\opt\apache-maven-3.6.0\bin\..
Java version: 1.8.0_192, vendor: Oracle Corporation, runtime: C:\opt\jdk-8u192\jre
Default locale: en_US, platform encoding: UTF-8
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

org.codehaus.mojo:native-maven-plugin
javah The command line is too long.

<localRepository>C:/m2</localRepository>

mvn -Dmaven.javadoc.skip=true -Dmaven.test.skip=true -DskipTests package

C:\hadoop-3.0.3-src\hadoop-hdfs-project\hadoop-hdfs-native-client\src
cmake -G "Visual Studio 15 2017 Win64"
Visual Studio 10 2010 Win64

msbuild native.sln /p:Configuration=Release /p:Platform=x64 /p:PlatformToolset=v141
msbuild winutils.sln /p:Configuration=Release /p:Platform=x64 /p:PlatformToolset=v141

C:\hadoop-3.0.3-src\hadoop-common-project\hadoop-common\src\main\native
C:\hadoop-3.0.3-src\hadoop-common-project\hadoop-common\src\main\winutils

C:\hadoop-3.0.3-src\hadoop-common-project\hadoop-common\target\bin
C:\hadoop-3.0.3-src\hadoop-hdfs-project\hadoop-hdfs-native-client\target\bin

C:\hadoop-3.1.1-src\hadoop-common-project\hadoop-common\src\main\native
C:\hadoop-3.1.1-src\hadoop-common-project\hadoop-common\src\main\winutils

C:\hadoop-3.1.1-src\hadoop-common-project\hadoop-common\target\bin
C:\hadoop-3.1.1-src\hadoop-hdfs-project\hadoop-hdfs-native-client\target\bin


11/04/2018 01:01 PM 87,552 hadoop.dll
11/04/2018 12:51 PM 30,096 hadoop.lib
11/04/2018 01:01 PM 774,144 hadoop.pdb
11/04/2018 01:09 PM 68,096 hdfs.dll
11/04/2018 01:09 PM 425,710 hdfs.lib
11/04/2018 01:09 PM 585,728 hdfs.pdb
11/04/2018 01:01 PM 1,461,772 libwinutils.lib
11/04/2018 01:01 PM 119,296 winutils.exe
11/04/2018 01:01 PM 1,298,432 winutils.pdb

winutils.exe
-> vcruntime140.dll
hadoop.dll
-> vcruntime140.dll
hdfs.dll
-> vcruntime140.dll
-> jvm.dll: JNI_CreateJavaVM, JNI_GetCreatedJavaVMs
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git "a/2018/11/11/\344\270\272-hadoop-\347\274\226\350\257\221-linux-\345\222\214-windows-\346\234\254\346\234\272\347\250\213\345\272\217/index.html" "b/2018/11/11/\344\270\272-hadoop-\347\274\226\350\257\221-linux-\345\222\214-windows-\346\234\254\346\234\272\347\250\213\345\272\217/index.html" new file mode 100644 index 00000000..43f3fe2d --- /dev/null +++ "b/2018/11/11/\344\270\272-hadoop-\347\274\226\350\257\221-linux-\345\222\214-windows-\346\234\254\346\234\272\347\250\213\345\272\217/index.html" @@ -0,0 +1,237 @@ + + + + + + + + + + + + 为 Hadoop 编译 Linux 和 Windows 本机程序 | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ 为 Hadoop 编译 Linux 和 Windows 本机程序 +

+ +

概述

系统环境

    +
  • 64 位英文操作系统
  • +
  • Hadoop 2 需要 CMake 2.6 或更新的版本
  • +
  • Hadoop 3 需要 CMake 3.1 或更新的版本
    1
    2
    3
    mkdir -p /opt/cmake-3 && curl -sSL https://cmake.org/files/v3.16/cmake-3.16.4-Linux-x86_64.tar.gz \
    | tar -xvz --strip-components=1 -C /opt/cmake-3
    export PATH=/opt/cmake-3/bin:$PATH
  • +
  • Protocol Buffers 编译器 2.5.0,不支持其它版本
  • +
  • JDK 1.8
  • +
  • Maven 3.6
  • +
  • Linux 用户需要 GCC 的 C++ 语言支持包。
  • +
  • Windows 系统用户需要 Microsoft Visual C++ 的 IDE 环境,不支持纯编译工具
  • +
+

常见问题

    +
  • 中文 Windows 系统用户需要安装英文支持,切换到英文界面编译
  • +
  • Windows 用户需要设置 maven 的 localRepository 为极短路径,例如 C:/repo
  • +
  • maven 需要下载不少软件包,请配置一个好的公网环境,或者在编译时做好重试,例如:
  • +
+
1
2
3
4
5
6
mvn clean
while true; do
mvn -Dmaven.javadoc.skip=true -Dmaven.test.skip=true -DskipTests -Pdist clean package
[ $? -eq 0 ] && break;
sleep 300;
done
+ +

Linux

在 CentOS 7 编译 Hadoop 2 最简单,CMake 和 Protocol Buffers 用系统内置的版本即可。

+

其它的环境需要自己确保 Protocol Buffers 编译器的版本一定是 2.5.0。CMake 的版本不要太旧。

+

系统配置

yum

+

yum install -y cmake gcc-c++ protobuf-compiler

+
+
1
2
3
cmake-2.8.12.2-2.el7.x86_64
gcc-c++-4.8.5-39.el7.x86_64
protobuf-compiler-2.5.0-8.el7.x86_64
+ +

jdk 1.8 & maven 3.6

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
export JAVA_HOME=/opt/jdk-8
export PATH=/opt/jdk-8/bin:/opt/maven-3/bin:/opt/cmake-3/bin:/usr/sbin:/usr/bin:/sbin:/bin

mkdir -p /opt/jdk-8 && curl -sSL https://cdn.azul.com/zulu/bin/zulu8.44.0.11-ca-jdk8.0.242-linux_x64.tar.gz \
| tar -xvz --strip-components=1 -C /opt/jdk-8

mkdir -p /opt/maven-3 && curl -sSL http://archive.apache.org/dist/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz \
| tar -xvz --strip-components=1 -C /opt/maven-3

# mvn --version
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /opt/maven-3
Java version: 1.8.0_242, vendor: Azul Systems, Inc., runtime: /opt/jdk-8/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.19.0-8-amd64", arch: "amd64", family: "unix"
+ +

Hadoop 2.7.7

    +
  • 2.7.7/Linux-x64
    1
    2
    3
    4
    5
    6
    -rw-r--r-- 1 root root 1235702 Nov  3 20:53 libhadoop.a
    lrwxrwxrwx 1 root root 18 Nov 3 20:53 libhadoop.so -> libhadoop.so.1.0.0
    -rwxr-xr-x 1 root root 724424 Nov 3 20:53 libhadoop.so.1.0.0
    -rw-r--r-- 1 root root 433452 Nov 3 20:53 libhdfs.a
    lrwxrwxrwx 1 root root 16 Nov 3 20:53 libhdfs.so -> libhdfs.so.0.0.0
    -rwxr-xr-x 1 root root 272064 Nov 3 20:53 libhdfs.so.0.0.0
  • +
+

Hadoop 2.8.5

+

Hadoop 3.0.3

+

Hadoop 3.1.1

+

Windows

系统配置

本机程序

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
https://github.com/protocolbuffers/protobuf/releases/download/v2.5.0/protoc-2.5.0-win32.zip
https://github.com/protocolbuffers/protobuf/releases/download/v2.5.0/protobuf-2.5.0.tar.gz

https://cmake.org/files/v3.12/cmake-3.12.4-win64-x64.zip
https://aka.ms/vs/15/release/vs_enterprise.exe

C:\>protoc --version
libprotoc 2.5.0

C:\>cmake --version
cmake version 3.12.4
CMake suite maintained and supported by Kitware (kitware.com/cmake).

C:\>cl
Microsoft (R) C/C++ Optimizing Compiler Version 19.15.26732.1 for x64
Copyright (C) Microsoft Corporation. All rights reserved.

C:\>link
Microsoft (R) Incremental Linker Version 14.15.26732.1
Copyright (C) Microsoft Corporation. All rights reserved.
+ + +

jdk 1.8 & maven 3.6

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
SET M2_HOME=C:\opt\apache-maven-3.6.0
SET MAVEN_OPTS=-Duser.language=en -Duser.country=US -Dfile.encoding=UTF-8

C:\>java -version
java version "1.8.0_192"
Java(TM) SE Runtime Environment (build 1.8.0_192-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.192-b12, mixed mode)

C:\>ant -version
Apache Ant(TM) version 1.10.5 compiled on July 10 2018

C:\>mvn --version
Apache Maven 3.6.0 (97c98ec64a1fdfee7767ce5ffb20918da4f719f3; 2018-10-25T02:41:47+08:00)
Maven home: C:\opt\apache-maven-3.6.0\bin\..
Java version: 1.8.0_192, vendor: Oracle Corporation, runtime: C:\opt\jdk-8u192\jre
Default locale: en_US, platform encoding: UTF-8
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

C:\hadoop-3.0.3-src\hadoop-hdfs-project\hadoop-hdfs-native-client\src
cmake -G "Visual Studio 15 2017 Win64"
Visual Studio 10 2010 Win64

msbuild native.sln /p:Configuration=Release /p:Platform=x64 /p:PlatformToolset=v141
msbuild winutils.sln /p:Configuration=Release /p:Platform=x64 /p:PlatformToolset=v141

C:\hadoop-3.0.3-src\hadoop-common-project\hadoop-common\src\main\native
C:\hadoop-3.0.3-src\hadoop-common-project\hadoop-common\src\main\winutils

C:\hadoop-3.0.3-src\hadoop-common-project\hadoop-common\target\bin
C:\hadoop-3.0.3-src\hadoop-hdfs-project\hadoop-hdfs-native-client\target\bin

C:\hadoop-3.1.1-src\hadoop-common-project\hadoop-common\src\main\native
C:\hadoop-3.1.1-src\hadoop-common-project\hadoop-common\src\main\winutils

C:\hadoop-3.1.1-src\hadoop-common-project\hadoop-common\target\bin
C:\hadoop-3.1.1-src\hadoop-hdfs-project\hadoop-hdfs-native-client\target\bin


11/04/2018 01:01 PM 87,552 hadoop.dll
11/04/2018 12:51 PM 30,096 hadoop.lib
11/04/2018 01:01 PM 774,144 hadoop.pdb
11/04/2018 01:09 PM 68,096 hdfs.dll
11/04/2018 01:09 PM 425,710 hdfs.lib
11/04/2018 01:09 PM 585,728 hdfs.pdb
11/04/2018 01:01 PM 1,461,772 libwinutils.lib
11/04/2018 01:01 PM 119,296 winutils.exe
11/04/2018 01:01 PM 1,298,432 winutils.pdb

winutils.exe
-> vcruntime140.dll
hadoop.dll
-> vcruntime140.dll
hdfs.dll
-> vcruntime140.dll
-> jvm.dll: JNI_CreateJavaVM, JNI_GetCreatedJavaVMs
+ +

Hadoop 3.0.3

+

Hadoop 3.1.1

+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git "a/2018/11/17/\345\271\266\345\217\221\347\274\226\347\250\213\346\246\202\350\277\260/concurrent-programming.png" "b/2018/11/17/\345\271\266\345\217\221\347\274\226\347\250\213\346\246\202\350\277\260/concurrent-programming.png" new file mode 100644 index 00000000..012b631e Binary files /dev/null and "b/2018/11/17/\345\271\266\345\217\221\347\274\226\347\250\213\346\246\202\350\277\260/concurrent-programming.png" differ diff --git "a/2018/11/17/\345\271\266\345\217\221\347\274\226\347\250\213\346\246\202\350\277\260/concurrent-programming.svg" "b/2018/11/17/\345\271\266\345\217\221\347\274\226\347\250\213\346\246\202\350\277\260/concurrent-programming.svg" new file mode 100644 index 00000000..956c673c --- /dev/null +++ "b/2018/11/17/\345\271\266\345\217\221\347\274\226\347\250\213\346\246\202\350\277\260/concurrent-programming.svg" @@ -0,0 +1 @@ +并发编程协作分工互斥Semaphoremonitor Lock Condition CountDownLatchCyclicBarrierPhaserExchanger无锁互斥锁immutable data structuresTLSlocal variablesCopy-on-WriteReadWriteLockatomic packagesynchronized Lock synchronized ReadWriteLockThreadPool/ExecutorForkJoinPool/ForkJoinTask Guarded Suspension (wait/notify)Balking pattern (reject)Messaging design patternScheduledThreadPoolExecutor \ No newline at end of file diff --git "a/2018/11/17/\345\271\266\345\217\221\347\274\226\347\250\213\346\246\202\350\277\260/concurrent-programming.xmind" "b/2018/11/17/\345\271\266\345\217\221\347\274\226\347\250\213\346\246\202\350\277\260/concurrent-programming.xmind" new file mode 100644 index 00000000..ce9b39ef Binary files /dev/null and "b/2018/11/17/\345\271\266\345\217\221\347\274\226\347\250\213\346\246\202\350\277\260/concurrent-programming.xmind" differ diff --git "a/2018/11/17/\345\271\266\345\217\221\347\274\226\347\250\213\346\246\202\350\277\260/hdd.jpg" "b/2018/11/17/\345\271\266\345\217\221\347\274\226\347\250\213\346\246\202\350\277\260/hdd.jpg" new file mode 100644 index 00000000..a68de514 Binary files /dev/null and "b/2018/11/17/\345\271\266\345\217\221\347\274\226\347\250\213\346\246\202\350\277\260/hdd.jpg" differ diff --git "a/2018/11/17/\345\271\266\345\217\221\347\274\226\347\250\213\346\246\202\350\277\260/index.html" "b/2018/11/17/\345\271\266\345\217\221\347\274\226\347\250\213\346\246\202\350\277\260/index.html" new file mode 100644 index 00000000..84a3d726 --- /dev/null +++ "b/2018/11/17/\345\271\266\345\217\221\347\274\226\347\250\213\346\246\202\350\277\260/index.html" @@ -0,0 +1,229 @@ + + + + + + + + + + + + 并发编程概述 | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ 并发编程概述 +

+ +

并发编程

并发编程领域可以抽象成三个核心问题:分工、协作和互斥。

+

并发编程全景图

+

分工

    +
  • ThreadPool/Executor
  • +
  • ForkJoinPool/ForkJoinTask
  • +
  • ScheduledThreadPoolExecutor
  • +
  • Guarded Suspension (wait/notify)
  • +
  • Balking pattern (reject)
  • +
  • Messaging design pattern
  • +
+

协作

    +
  • Semaphore
  • +
  • monitor
      +
    • Lock
        +
      • ReadWriteLock
      • +
      +
    • +
    • Condition
    • +
    • synchronized
    • +
    +
  • +
  • CountDownLatch
  • +
  • CyclicBarrier
  • +
  • Phaser
  • +
  • Exchanger
  • +
+

互斥

无锁

    +
  • local variables
  • +
  • immutable data structures
  • +
  • TLS
  • +
  • Copy-on-Write
  • +
  • CAS
  • +
  • atomic package
  • +
+

互斥锁

    +
  • synchronized
  • +
  • Lock
  • +
  • ReadWriteLock
  • +
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2018/11/18/newsql/index.html b/2018/11/18/newsql/index.html new file mode 100644 index 00000000..dee86c69 --- /dev/null +++ b/2018/11/18/newsql/index.html @@ -0,0 +1,324 @@ + + + + + + + + + + + + NewSQL | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ NewSQL +

+ +

NewSQL

Bigtable & NoSQL

在 CAP 定理(2000 年)的推波助澜下,NoSQL 运动发展的如火如荼(AP 系统如 Cassandra、Voldemort、Tokyo Cabinet、Riak;CP 系统如 HBase、Hypertable、MongoDB、Redis),并总结出了自己的设计哲学:

+
    +
  • no SQL
  • +
  • no ACID
  • +
  • no schema
  • +
  • high performance
  • +
  • high scalability
  • +
  • high availability
  • +
  • low latency
  • +
  • relaxed consistency
  • +
+

然而,随着 NoSQL 系统在应用中的广泛使用,系统设计中抛弃的技术债务成了应用开发人员的负担,开发接口千奇百怪,数据不一致问题状况百出,事务一致性无法保证,正如 Eric Brewer 所说:

+

The hidden cost of forfeiting consistency, which is the need to know the system’s invariants. The subtle beauty of a consistent system is that the invariants tend to hold even when the designer does not know what they are.

+

从 NoSQL 转向 NewSQL

Spanner (2012/2017, NoSQL is Out and NewSQL is In) 是一个全功能的 SQL 系统,作者在论文中再次强调了支持事务和 SQL 的重要性:

+

…developers of many OLTP applications found it difficult to build these applications without a strong schema system, cross-row transactions, consistent replication and a powerful query language.

+

如果没有强表达能力的查询语言:

+

…developers had to write complex code to process and aggregate the data in their applications.

+

与此同时,作者对 NoSQL with ACID + SQL 的技术架构也寄予了高度的肯定:

+

A scalable, manageable, transactional key-value store is perhaps the lowest common denominator for building enterprise-strength global storage systems. It has been demonstrated by our colleagues from the F1 team that a transactional NoSQL core can be used to build a scalable SQL DBMS.

+

并且,在存储系统中松耦合还是紧耦合实现 SQL 还是一个需要认真讨论的问题:

+

both the loosely coupled (in case of F1) and tightly coupled SQL designs can be deployed successfully, and even simultaneously, on a transactional NoSQL core. A detailed exploration of the pros and cons of these designs is still outstanding. But it is perhaps fair to say that from the perspective of many engineers working on the Google infrastructure, the SQL vs NoSQL dichotomy may no longer be relevant.

+

NewSQL 的核心特性

NewSQL 的核心特性如下:

+
    +
  • 支持 SQL 接口。
  • +
  • 支持 ACID 事务语义。
  • +
  • 在 OLTP 场景下具备 NoSQL 的高性能、高可用、高扩展性。
  • +
+

Spanner 和 F1 论文发表至今,催生了一些优秀的 NewSQL 开源项目:

+
    +
  • 2015 年 5 月 24 日,HP 开源 Trafodion,一款基于 HBase,支持 ACID 事务、SI 隔离级别的 SQL 数据库;2018 年 1 月 10 日,Apache 宣布 Trafodion 成为顶级项目。
  • +
  • 2015 年 6 月 4 日,前 Google 员工创办 CockroachDB;2015 年融资 600 万美元;2016 年融资 2000 万美元;2017 年融资 2700 万美元。
  • +
  • 2015 年中,前豌豆荚员工发布 TiDB;2017 年融资 1500 万美元。
  • +
  • 2017 年 11 月 2 日,前 Facebook 员工创办 YugaByte DB;2017 年融资 800 万美元;2018 年融资 1600 万美元。
  • +
+

它们的共同点是都依赖于一个支持事务的 NoSQL 基础系统。从这些项目的实现架构来看,主要分为两种:

+
    +
  • 原生实现:如 CockroachDB、YugaByteDB
  • +
  • NoSQL+ACID+SQL:如 TiDB、Trafodion
  • +
+

事务并发控制

从 NewSQL 的发展趋势来看,ACID 事务的回归是必然的,而且在分布式场景下,均致力于实现可扩展、高性能的串行化隔离级别,这在传统数据库的实现中是难以达到的。事务管理的核心技术是并发控制,原子性、一致性、隔离性都与它相关。

+

事务的并发控制是为了实现事务的调度。

+

一个正确、高效的事务调度应满足如下属性:

+
    +
  • 可串行化:多个并发事务的调度 S 与一个串行化的调度产生相同的结果,则称这个调度 S 是可串行化的;在数据库实现中,一般使用冲突可串行化技术。
  • +
  • 可恢复性:已经提交的事务没有读过被终止的事务写过的数据,防止脏读异常。
  • +
  • 避免级联终止:避免由于事务 T1 的终止而导致事务 T2 的终止。
  • +
  • 严格性:先发生写操作的事务的提交或终止应先于其它冲突事务的提交或终止。
  • +
+

并发控制从实现思路维度可以分为如下三类:

+
    +
  • 乐观:重在事后检测,在事务提交时检查是否满足隔离级别。满足,则提交;否则回滚并自动重新执行。
  • +
  • 悲观:重在事前预防,在事务执行时检查是否满足隔离级别。满足,则继续执行;否则等待或回滚。
  • +
  • 半乐观:混合使用乐观和悲观技术实现事务并发控制。
  • +
+

并发控制从实现方式维度可以分为如下几种:

+
    +
  • 基于锁的并发控制

    +
      +
    • 2PL(two-phase locking):事务在执行期间被明确的划分为 growing 和 shrinking 阶段,growing 阶段只能持有锁不能释放锁;shrinking 阶段只能释放锁不能持有锁,仅满足可恢复性;
    • +
    • S2PL(strict two-phase locking):在满足 2PL 的前提下,要求持有的排它锁必须在事务提交后才释放,避免了级联回滚;
    • +
    • SS2PL(strong strict two-phase locking):在满足 2PL 的前提下,要求事务提交之前不得释放任何锁,保证了严格性。
    • +
    +
  • +
  • 基于时间戳的并发控制

    +

    在事务开始时生成一个单调递增的时间戳,数据项上维护最近读时间戳和最近写时间戳。每次读写操作,系统都会将事务时间戳与数据项上的时间戳进行检查,对于任意读写操作,如果事务时间戳小于数据项的最近写时间戳,则将事务回滚;对于写操作,如果事务时间戳小于数据项的最近读时间戳,则将事务回滚;如果都满足,则继续访问下一个数据项。

    +
  • +
  • 基于 OCC 的并发控制

    +

    事务的生命周期被划分为三个阶段,将串行化检测推迟到提交阶段:

    +
      +
    • 读阶段:事务写操作仅是对事务私有空间中数据的更新,并不对数据库中的数据项进行真实的更新,保证读阶段没有任何事务冲突及锁开销;
    • +
    • 验证阶段:检测事务是否满足串行化隔离级别;
    • +
    • 写阶段:将事务私有空间中的更新数据写入数据库。
    • +
    +
  • +
  • 基于多版本的并发控制

    +

    每一次写操作会生成一个新的数据项版本,数据项的版本号可以使用事务的时间戳或事务号;系统维护多个数据版本,读操作根据所在事务的时间戳或事务号能够读到指定的版本,做到读-写或写-读操作不阻塞,写-写操作的冲突依赖 2PL 实现。

    +
  • +
+

总结

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
生产级 NewSQL 数据库年份并发控制隔离级别客户端
Cloud Spanner2017MVCC + SS2PLLinearizabilityANSI 2011 SQL
OceanBase 2.02016MVCC + SS2PLRCOracle & MySQL wire protocol
CockroachDB 2.1.52017MVCC + TOSSIPostgreSQL wire protocol
TiDB 2.1.42017MVCC + SS2PLSIMySQL wire protocol
FoundationDB 6.0.182018MVCC + OCCSSI
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git "a/2018/11/24/windows-\345\221\275\344\273\244\350\241\214\347\252\227\345\217\243\347\232\204\345\220\257\345\212\250\347\233\256\345\275\225/index.html" "b/2018/11/24/windows-\345\221\275\344\273\244\350\241\214\347\252\227\345\217\243\347\232\204\345\220\257\345\212\250\347\233\256\345\275\225/index.html" new file mode 100644 index 00000000..c837cd4d --- /dev/null +++ "b/2018/11/24/windows-\345\221\275\344\273\244\350\241\214\347\252\227\345\217\243\347\232\204\345\220\257\345\212\250\347\233\256\345\275\225/index.html" @@ -0,0 +1,191 @@ + + + + + + + + + + + + Windows 命令行窗口的启动目录 | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Windows 命令行窗口的启动目录 +

+ +

Windows 命令行窗口的启动目录

菜单中的命令提示符的链接文件

当前用户配置

1
2
3
%LOCALAPPDATA%\Microsoft\Windows\WinX\Group3\01 - Command Prompt.lnk
%LOCALAPPDATA%\Microsoft\Windows\WinX\Group3\02 - Command Prompt.lnk
%APPDATA%\Microsoft\Windows\Start Menu\Programs\System Tools\Command Prompt.lnk
+ +

默认用户配置

1
2
3
%USERPROFILE%\..\Default\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\System Tools\Command Prompt.lnk
%USERPROFILE%\..\Default\AppData\Local\Microsoft\Windows\WinX\Group3\01 - Command Prompt.lnk
%USERPROFILE%\..\Default\AppData\Local\Microsoft\Windows\WinX\Group3\02 - Command Prompt.lnk
+ +

修改方法

在对应链接文件上点击右键,修改起始位置为你需要的目录即可。

+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git "a/2018/11/25/\345\270\270\350\247\201\347\232\204-windows-\345\220\257\345\212\250\347\250\213\345\272\217\344\275\215\347\275\256/index.html" "b/2018/11/25/\345\270\270\350\247\201\347\232\204-windows-\345\220\257\345\212\250\347\250\213\345\272\217\344\275\215\347\275\256/index.html" new file mode 100644 index 00000000..f17fdf69 --- /dev/null +++ "b/2018/11/25/\345\270\270\350\247\201\347\232\204-windows-\345\220\257\345\212\250\347\250\213\345\272\217\344\275\215\347\275\256/index.html" @@ -0,0 +1,201 @@ + + + + + + + + + + + + 常见的 Windows 启动程序位置 | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ 常见的 Windows 启动程序位置 +

+ +

常见的 Windows 启动程序位置

Windows 启动程序位置

注册表

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
+
+

硬盘位置

在开始菜单的运行输入框中,输入 “shell:startup” 或者 “shell:common startup”,也可以打开以下对应的位置:

+
%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\
+%ProgramData%\Microsoft\Windows\Start Menu\Programs\Startup\
+
+

禁用、删除或者增加启动程序

禁用或启用启动程序

打开任务管理器,点击“启动”页面,找到启动项目,点击右键,选择“禁用”或“启用”。

+

删除启动程序

    +
  • 尽量不要删除项目,强烈建议通过任务管理器来禁用它。
  • +
  • 要删除启动项目,你只需在找到的位置删除即可。
  • +
  • 备份后再删除,并且使用重启系统来验证。
  • +
+

增加启动程序

要增加启动项目,不建议修改注册表,请在硬盘位置增加快捷方式即可。

+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git "a/2018/12/01/\346\234\252\346\235\24520\345\271\264\347\232\20412\344\270\252\350\266\213\345\212\277/index.html" "b/2018/12/01/\346\234\252\346\235\24520\345\271\264\347\232\20412\344\270\252\350\266\213\345\212\277/index.html" new file mode 100644 index 00000000..daa77a75 --- /dev/null +++ "b/2018/12/01/\346\234\252\346\235\24520\345\271\264\347\232\20412\344\270\252\350\266\213\345\212\277/index.html" @@ -0,0 +1,209 @@ + + + + + + + + + + + + 未来20年的12个趋势 | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ 未来20年的12个趋势 +

+ +

未来20年的12个趋势

我们必须要相信那些不可能的事情,那些看起来不太可能为我们所使用的东西,将来肯定会为我们所用。

+

我们看过去,认为过去是好的创业时机。同样,未来也是最好的时候。我们也处于最好的创业时代,因为我们还处在一个起点的时代。

+

第一个趋势:形成(becoming),所有的东西都在不断升级

所有的东西都在不断地流动,不断升级,变得越来越好。所有的东西都是在形成的过程中,我们之前看到的是产品,现在看到的是过程。不管你多大年纪,处在人生哪个阶段,总会有新的东西出现,所以我们要永远处于学习的状态。

+

第二个趋势:知化(Cognifying),与人工智能的合作表现决定你的薪酬

很多东西已经变得很聪明了。未来将有数以万计创业公司,他们从事的是人工智能用于某一个领域的工作。使用者越来越多的话,机器会越来越聪明,这是一种滚雪球的方式。有很多新工作,是机器人去帮助你完成的,工作职位是不断增加的。 +对效率要求不高的工作更适合人类,比如要求创造力的工作,因为创造本身就是不讲究效率的,不用考虑正确性,这是人类适合去做的工作。未来不管是哪个领域,实际上它都是最聪明的人加上机器。

+

第三个趋势:读屏(Screening),任何一种平面都可以成为屏幕

屏幕可以跟踪你的眼神,知道我们注意力聚焦在那儿了,我们重视什么东西,然后改变屏幕上呈现出来的内容。

+

第四个趋势:流动(Flowing),你做的所有生意,都是数据

什么东西在流动呢?数据,不管你是做房地产、医药、化工,还是教育,其实你做的生意都是数据。

+

第五个趋势:合成(Remixing),大多数创新都是现有事物的重组

经济学家发现,全新的东西很少,大多数创新都是现有事物的重新组合。这种重组就是我这里所说的重混。这是世界发展的方向,重要的趋势。

+

第六个趋势:过滤(Filtering),能吸引注意力,就能赚到钱

我们肯定需要一些人来帮忙,找到我们真正需要的东西,这就叫做过滤。 金钱是会随注意力走的,你能够吸引注意力,就会赚到钱。

+

第七个趋势:互动(Interacting),它的影响将和AI一样深远

电脑会变成什么样子?基本上你可以用整个身体没有任何障碍地互动,电脑是全方位可互动的机器。就像交响乐团的指挥家一样。有一些纳米雷达技术,它可以知道你手指动作的意义。

+

第八个趋势:使用(Accessing),所有权价值变成使用权价值

“使用”这个词其实很难去解释,也就是之前我们是拥有一个产品,之后我们去使用某一种服务。 +拥有的概念已经不是那么重要了,使用在很多方面比拥有更好,你马上用到一个东西,用完之后马上可以丢掉,肯定比拥有某些东西要更好。

+

第九个趋势:共享(Sharing),核心是协作

我们能够做什么? 能让分享得越多,价值提升越多。其实我们在讲分享时,不是一般意义的分享,而是在讲协作。以一种规模化的方式合作,可以让成千上万几十亿的人以合作的方式进行互动,这些人的共同协作可以带来社会的变革。这种规模是之前大家都无法想象的,这就是未来分享的趋势所在,这会产生巨大的价值和财富,带来巨大的社会变革。

+

第十个趋势:开始(Beginning),技术的用途,是用出来的

关于技术,在最开始的时候,没有人知道新的发明是最适合用于什么。所以,用途很多时候就是通过使用来发现的,不断尝试,在发明的时候,我们可能想不了那么多。

+

我们要评估技术的时候,也必须要使用这个技术,而不仅仅是空想我们要指引和控制技术发展的方向,必须要使用,然后去调试、优化,使这个技术变得更好。

+

学习如何去创造新的东西,如何去做创造和引领,还要去思考,勇于试错(不能害怕这个错误),犯错和学习进步不能分开。持续性的小错误的容忍性,才能有大的创新的推动。

+

第十一个趋势:提问(Questionning),好问题比完美的答案更重要

今天要找到答案很容易,回答变得越来越便宜,同时提问变得越来越贵了,我们必须要培训人们去提问,让他们创造问题,一个好的问题,会比一个完美的回答更有价值。

+

你必须要有非常好的驾驭问题的思维方式,因为问题本身可以开发一个新领域,是一个能动最好的推送者,像引擎一样,推动人的思维不断去创造。

+

问题比回答更有意义,好的问题是新的领域,问一个好的问题,必须要有一个驾驭问题的能力。必须要有意识去挖掘问题,不管设想是怎样的,要有问题提出来。

+

第十二个趋势:颠覆(Disruption),内因从来不是主要原因

不管你在哪个行业,颠覆不是从内部出现的,而是从外部推动的。一些一蹴而就的现象和技术,只是看上去很突然,但它其实已经在背后存在了很多年,只是因为没有满足成为产品的底限要求,所以到不了大众的视线。

+

创造或者发明,是一个不挣钱的市场。首先大多数的发明都是失败的,风险非常高,一开始的质量非常差,也就意味着利润非常低,任何商人都会告诉你,投资这一行是非常不挣钱的。

+

物种进化过程中不断思考如何进化来提升适应度,低的物种会被淘汰,高适应度的物种会存活下来。

+

所有的企业都在不断追求卓越,也是为了提升适应度。当处于生态圈里卓越的公司,想要攀登到更高峰的时候,需要先下山(降低适应度)再提升来达到顶峰,企业越成功越难下山。

+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2018/12/02/dynamiq-from-big-little-to-big-middle-little/index.html b/2018/12/02/dynamiq-from-big-little-to-big-middle-little/index.html new file mode 100644 index 00000000..e6e8b1f3 --- /dev/null +++ b/2018/12/02/dynamiq-from-big-little-to-big-middle-little/index.html @@ -0,0 +1,219 @@ + + + + + + + + + + + + DynamIQ - From big.LITTLE to big.Middle.LITTLE | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ DynamIQ - From big.LITTLE to big.Middle.LITTLE +

+ +

DynamIQ big.LITTLE 简介

DynamIQ 是 Arm Cortex-A CPU 的新技术,重新定义了多核计算,将作为下一代计算技术的基础。

+
    +
  • 一种新的单一集群设计,具有多达八个异构 CPU,允许不同的配置,最多支持四个 big CPU 或八个 LITTLE CPU 或其组合。如 1 + 7(即 1xbig 和 7xLITTLE CPU),2 + 4, 1 + 3 等组合,以提供可扩展的解决方案
  • +
  • 专为在 CPU 上提供更多 AI 和 AR 计算机性能而设计的高级计算功能
  • +
  • 重新设计的内存子系统,在群集中的所有核心之间共享,以提高响应速度和效率
  • +
  • 无论有没有 LITTLE 配置,都可以更灵活地扩展到智能手机以外的不同市场
  • +
  • 通过内置硬件功能提高功耗,实现更高的效率
  • +
  • 将 Cortex-A CPU 与外部加速器和 I/O 相关 IP 紧密耦合,在 CPU 和 SoC 上的专用加速器硬件之间提供高达 10 倍的响应时间,从而实现更高的性能和更低的延迟。
  • +
  • 基于 DynamIQ 的系统还集成了高级功能,可提高工业和基础设施等应用的可靠性,可用性和可维护性(RAS)。
  • +
+

DynamIQ 带来了一种新的技术架构,可以改变异构处理的格局。它通过将 big 和 LITTLE 集群组合在一起形成一个完全集成的 CPU 集群来实现这一点,该集群由 big 和 LITTLE CPU组成。使用DynamIQ 构建的 big.LITTLE 设计称为 DynamIQ big.LITTLE。

+

DynamIQ big.LITTLE 技术的优势

单线程性能提升带来更高的用户体验(UX),例如人工智能(AI)和增强现实(AR),将继续需要更高级别的用户体验。但是热预算会限制设备可实现的性能。DynamIQ big.LITTLE系统可以实现更长时间的持续性能,以及使用高性能的突发请求,它还具有更快的 CPU 电源状态转换能力。

+

DynamIQ big.LITTLE 引入了以下好处:

+
    +
  • 在完全集成的解决方案中更广泛的产品差异化
  • +
  • 通过更精细的 CPU 速度控制获得更高的用户体验(UX),AI 和 AR 等高级用例的数据处理速度更快,更复杂
  • +
  • 通过先进的电源管理功能提高能效
  • +
+

DynamIQ big.LITTLE 技术带来的影响

DynamIQ 将改变计算发生的方式和位置,以下列方式影响我们的生活。例如:

+
    +
  • 几乎无限的配置,为不同层级的解决方案和性能提供新级别的灵活性和可扩展性; 这为消费者和设备选择提供了更多选择,以满足他们的需求
  • +
  • 内置省电功能,可实现从设备到云的创新。更薄的设备,更长久的电池,服务器场的节能 - 电源效率优势涵盖所有市场
  • +
  • 为设备带来智能计算可提高数据安全性和隐私性,以及更快的响应时间,提高人工智能的性能 - 无论是在家中,还是在汽车中,还是在云中
  • +
+

Arm DynamIQ 技术是为下一代智能设备提供更智能,更快速,更强大的用户体验的新基础。它将在一个要求苛刻的新设计市场中推动创新,从更薄的设备到基于云的解决方案 - 无论在何处进行计算。

+

支持 DynamIQ big.LITTLE 的 CPU

    +
  • 麒麟 980 采用了 2+2+4 的核心方案,2 个大核(Cortex-A76@2.6GHz,重载)、2 个中核(Cortex-A76@1.92GHz,中载)、4 个小核(Cortex-A55@1.8GHz,轻载)。

    +
  • +
  • 骁龙 855 则是基于 Cortex-A76 的 kryo 485 架构的 1+3+4 的核心方案,1 个大核(2.84GHz,重载)、3 个中核(2.42 GHz,中载)、4 个小核(1.80 GHz,轻载)。

    +
  • +
+

从技术规格上看,855 和麒麟 980 的相同点很多。二者都用了台积电 7nm 制程、CPU 部分都是在 A76 和 A55 核心之上仅做了小修改,都是 8 核心「大、中、小」三丛集设计,两颗 ISP,也都有 NPU。

+

区别有三处:第一处是 855 的 GPU 还是配备了高通的 Adreno 640,而 980 用了 ARM 公版的 Mali-G76;第二处是三丛集的搭配方案,855 选择单超大核的方案,而 980 是「224」的配置;第三是 855 上搭载的高通一些特色功能,比如 True Wireless、aptX、AIE SDK 等等。

+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2018/12/08/scm/index.html b/2018/12/08/scm/index.html new file mode 100644 index 00000000..d4aa08cd --- /dev/null +++ b/2018/12/08/scm/index.html @@ -0,0 +1,324 @@ + + + + + + + + + + + + SCM | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ SCM +

+ +

供应链系统

供应链管理系统(Supply Chain Management, SCM)是指为终端客户提供商品、服务或信息,从最初的材料供应商一直到最终用户的整条链上的企业的关键业务流程和关系的一种集成。 +它是全方位的企业管理应用软件,可以帮助企业实现整个业务运作的全面自动化。

+

它为供应链上下游企业提供信息服务、交易服务、物流服务、金融服务、售后维保服务、营销服务等一站式深度价值服务,实现数据互通、全链融合,形成物流、信息流、单证流、商流和资金流五流合一的领先模式。实现整体供应链可视化,管理信息化,整体利益最大化,管理成本最小化,综合提升平台运营效率与平台收益。

+

要素

Douglas M.Lambert等人在前人研究和对90多家实施供应链管理的企业进行的调查的基础上,提出了供应链系统的模型如图。该模型突出强调了供应链上各节点企业之间相互关联的本质以及成功设计和管理供应链系统的一些关键问题。由三个相互关联的部分组成:供应链网络结构;供应链业务流程;供应链管理要素。

+

供应链系统的模型

+

供应链网络结构

是指确定供应链上的关键成员企业及其相互之间的关系。确定供应链上的关键成员企业,一般是从战略上进行分析,将链上的企业分成基本的企业成员和辅助流程及其特性。关键成员企业之间的关系是指明确各企业在网络结构中的纵向和横向结构中的位置。横向结构是指供应链的价值链体系结构,而纵向结构是指单个企业和其供应商、客户的关系。弄清供应链的起始位置,就是对供应链的价值链体系进行建模,确定供应链的起始位置,描述企业在供应链中的作用和角色,分析供应链价值体系中存在的问题及其根源。而企业在纵向结构中的位置,就是确定单个企业的供应链流程的需求、顾客价值的实现情况,分析企业内流程中存在的问题和根源。

+

供应链业务流程

确定在供应链系统中哪些核心流程应该连接并集成起来。全球供应链论坛将供应链中的流程总结为:客户关系管理流程;客户服务流程;需求流程;生产流程;采购流程;产品研发流程;反馈流(信息流、资金流)流程。分析供应链业务流程需要企业从自己的核心能力出发,定义自己的核心流程,而将非核心流程转让。

+

供应链管理要素

供应链管理和集成的效果取决于供应链上企业边界处流程接口的管理和集成的程度。流程接口的集成和管理,包含以下两个方面的因素:物理连接和技术因素。

+

概念

供应链是围绕核心企业,通过对信息流,物流,资金流的控制,从采购原材料开始,制成中间产品以及最终产品,最后由销售网络把产品送到消费者手中的,将供应商,制造商,分销商,物流服务商,零售商,直到最终用户连成一个整体的功能网链结构。它不仅是一条连接供应商到用户的物流链、信息链、资金链,而且是一条增值链,物料在供应链上因加工、包装、运输等过程而增加其价值,给相关企业带来收益。

+

特征

系统原理认为,供应链是一个系统,是由相互作用、相互依赖的若干组成部分结合而成的具有特定功能的有机整体。供应链是围绕核心企业,通过对信息流、物流、资金流的控制,把供应商、制造商、分销商、零售商直到最终用户连成一个整体的功能网链结构模式。供应链的系统特征主要体现在以下几点:

+
    +
  1. 供应链的整体功能

    +

    这一整体功能是组成供应链的任一成员企业都不具有的特定功能,是供应链合作伙伴间的功能集成,而不是简单叠加。如果要打造一个真正的以全程供应链为核心的市场能力,就必须从最末端的供应控制开始,到最前端的消费者,在整个全程供应链上,不断优化不断建设,然后集成这些外部资源。供应链系统的整体功能集中表现在供应链的综合竞争能力上,这种综合竞争能力是任何一个单独的供应链成员企业都不具有的。

    +
  2. +
  3. 供应链系统的目的性

    +

    在供应链里流动的有物流、信息流、知识流、资金流,如何有效降低库存,加速物流及相关流的周转,提高企业生产及商品流通的效率,迅速对市场机遇进行反映成为迫切需要解决的问题。供应链系统有着明确的目的,这就是在复杂多变的竞争环境下,以最低的成本、最快的速度、最好的质量为用户提供最满意的产品和服务,通过不断提高用户的满意度来赢得市场,这一目的也是供应链各成员企业的共同目的。

    +
  4. +
  5. 供应链合作伙伴间的密切关系

    +

    供应链中主体之间具有竞争、合作、动态等多种性质的供需关系。这种关系是基于共同利益的合作伙伴关系,供应链系统目的的实现,受益的不只是一家企业,而是一个企业群体。供应链管理改变了企业的竞争方式,强调核心企业通过与供应链中的上下游企业之间建立战略伙伴关系,使每个企业都发挥各自的优势,在价值增值链上达到多赢互惠的效果。因此,各成员企业均具有局部利益服从整体利益的系统观念。

    +
  6. +
  7. 供应链系统的环境适应性

    +

    在经济全球化迅速发展的今天,企业面对的是一个迅速变化的买方市场,用户在时间方面的要求也越来越高,用户不但要求企业要按时交货,而且要求的交货期越来越短,这就要求企业能对不断变化的市场做出快速反应,不断地开发出定制的”个体化产品”去占领市场以赢得竞争。供应链具有灵活快速响应市场的能力,通过各节点企业业务流程的快速组合,加快了对用户需求变化的反应速度,各主体通过聚集而相互作用,以期不断地适应环境。

    +
  8. +
  9. 供应链系统的层次性

    +

    运作单元、业务流程、成员企业、供应链系统、整个运作环境构成了不同层次上的主体,每个主体具有自己的目标、经营策略、内部结构和生存动力。供应链各成员企业分别都是一个系统,同时也是供应链系统的组成部分;供应链是一个系统,同时也是它所从属的更大系统的组成部分。从系统层次性的角度来理解,相对于传统的基于单个企业的管理模式而言,供应链管理是一种针对更大系统(企业群)的管理模式。

    +
  10. +
+

价值

供应链管理软件采用了人工智能和物联网等新技术,能够帮助你实现实时运营。凭借全面的可视性和高级分析功能,你能够顺利执行计划和寻源流程,并在适当的时机交付恰当的商品和物料。通过动态预测和持续更新预测结果,企业可以将库存天数减少 10% 以上。

+
    +
  1. 数据传输安全,保证随时掌握情况

    +

    系统将企业管理与外围企业管理有机的结合在一起,解决了因供应商分散不集中、产品品种太多、订单过于频繁等情况而导致的品牌营运商与供应商之间存在的沟通问题、数据传输及时性问题、数据安全性问题、数据完整性问题等,整合品牌运营商与上游资源,实现效率的极大提升。

    +
  2. +
  3. 信息沟通及时,生产发货完美整合

    +

    品牌营运商通过供应链管理系统发布需求信息,从而使供应商能及时组织生产、发货等工作;能通过供应链管理系统知道货品从供应商到门店的整个物流过程。同时供应商也能通过供应链管理系统了解到自己所生产货品在门店的库存及销售情况。从而达到了供应商与营运商之间的互动。

    +
  4. +
  5. 缩短生产周期,降低企业运营成本

    +

    企业采用供应链管理系统可以解缩短与供应商的业务洽谈时间、大幅度减少采购成本。供应商也能通过系统了解自己的产品的应用情况,好作出合理的补货策略。

    +
  6. +
  7. 促进愉快合作,建立良好的供应商关系

    +

    通过改善与供应商的业务处理流程,与供应商进行协同办公,进行密切的信息交换,加强了对例外事件管理的能力和响应速度,与供应商建立稳固、长期的伙伴关系。

    +
  8. +
+

分类

功能性供应链 (物理功能)

    +
  • 市场需求比较稳定
  • +
  • 协调供应链间的信息,保持高的平均利用率
  • +
  • 重点在于降低生产、运输、库存等方面的费用
  • +
  • 关注质量和成本
  • +
+

反应性供应链 (市场功能)

    +
  • 市场不确定向高
  • +
  • 不仅需要供应链中的信息,还需要市场信息
  • +
  • 主要考虑供应链的响应速度和柔性能力,其费用则退而求其次
  • +
  • 关注质量,速度和柔性
  • +
+

平衡与倾斜

    +
  • 供应链的容量能满足用户需求时,供应链处于平衡状态。
  • +
  • 当市场变化加剧,造成供应链的成本增加,库存增加,浪费增加时,供应链处于倾斜状态。
  • +
+

管理模块

    +
  • 合作,决策,激励,自律机制

    +
  • +
  • 需求计划,预测

    +
  • +
  • 订单满足,考虑时间和制约因素

    +
  • +
  • 战略计划

    +
  • +
  • 供应商管理

    +
  • +
  • 库存管理

    +
  • +
  • 客户关系管理

    +
  • +
  • 分销计划

    +
  • +
  • 生产排程

    +
  • +
  • 运输计划

    +
  • +
  • 运输执行

    +
  • +
+

问题

    +
  • 没有正规的供应链管理策略
  • +
  • 没有协调企业资源更高的权重
  • +
  • 改革关键流程的阻力
  • +
  • 跨职能的障碍
  • +
  • 缺乏有效测量供应链绩效的评价指标
  • +
  • 缺乏应用和集成技术的能力
  • +
+
    +
  1. 在企业内外同时采取有力措施
  2. +
  3. 充分发挥信息的作用
  4. +
  5. 供应链企业的组成和工作
  6. +
  7. 计算机技术和人工职能技术的广泛应用
  8. +
  9. 标准和法规的作用
  10. +
  11. 方法论的指导,集成化方法论
  12. +
+
    +
  • 如何度量企业柔性?
  • +
  • 如何检测雇员和小组的技能?
  • +
  • 缩短提前期和库存对竞争能力有多大好处?
  • +
  • 技能标准对企业柔性又会有什么影响?
  • +
+

设计

目前国内已有专业的物流咨询公司对供应链系统进行了深入研究,并取得了突破性成绩,提出企业所处的竞争环境不同,企业的战略发展方向不同,决定了供应链系统的设计必须视企业具体情况来量身定做。

+

但总的原则是不变的,即必须确保实现高顾客满意度和企业成本最小化,在此目标下合理规划包括生产地决定、仓储管理、运输配送、信息处理、支付系统这五大供应链模块。如果对顾客满意度的影响因素进一步深入分析,我们可以发现,在多数情况下,对时间和成本的有效控制是供应链系统设计的主要目标。综合考虑时间和成本,具体的供应链战略则会有多种选择,我们需要对市场和竞争环境进行深入分析,并对所得信息和初步假设做出客观的定量和定性评估后确定最优的方案。

+

参考框架

基于分布式设计思想,采用多层、解耦的设计原则,将前端应用能力下沉,在后端业务支撑层中构建,企业可以在统一的运营中心集中运营,同时支持多种接入渠道,适配各种终端,从而避免一种运营模式建立一个运营后台的弊端。

+
    +
  1. 接入层

    +

    接入认证,服务注册,服务执行,任务调度,服务监控

    +
  2. +
  3. 平台运营层

    +

    权限管理,注册审核,集中采购,询价报价,电子合同,内容管理, + 资金账户管理,保险管理

    +
  4. +
  5. 业务支撑层

    +
      +
    1. 商品服务平台

      +

      品牌型号管理,商品管理,产品管理,虚拟仓位管理

      +
    2. +
    3. 订单服务平台

      +

      订单轨迹,订单流转,订单环节处理,订单流程配置,订单统计分析,异常订单管理

      +
    4. +
    5. 物流服务平台

      +

      订单推送,派单处理,物流跟踪,备货管理,补货调拨,物流管理,复盘管理

      +
    6. +
    7. 金融服务平台

      +

      账户管理,收付管理,财务管理,对账管理,授信管理,差异管理

      +
    8. +
    9. 大数据分析平台

      +

      数据采集,决策分析,风险监控,精准维系,数据开放,MPP数据处理,Hadoop数据处理,流数据处理

      +
    10. +
    +
  6. +
  7. 外部系统接口

    +

    金融机构平台,第三方支付平台,物流公司系统,仓储系统,企业ERP系统,企业财务系统

    +
  8. +
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2018/12/08/scm/scm-module.jpg b/2018/12/08/scm/scm-module.jpg new file mode 100644 index 00000000..0d981b15 Binary files /dev/null and b/2018/12/08/scm/scm-module.jpg differ diff --git a/2018/12/08/scm/scm-module.pdf b/2018/12/08/scm/scm-module.pdf new file mode 100644 index 00000000..9ba401d0 Binary files /dev/null and b/2018/12/08/scm/scm-module.pdf differ diff --git a/2018/12/08/scm/scm-module.png b/2018/12/08/scm/scm-module.png new file mode 100644 index 00000000..9093e58f Binary files /dev/null and b/2018/12/08/scm/scm-module.png differ diff --git a/2018/12/15/running-ceph-inside-docker/index.html b/2018/12/15/running-ceph-inside-docker/index.html new file mode 100644 index 00000000..5ed1dd4b --- /dev/null +++ b/2018/12/15/running-ceph-inside-docker/index.html @@ -0,0 +1,231 @@ + + + + + + + + + + + + Running Ceph inside Docker | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Running Ceph inside Docker +

+ +

Running Ceph inside Docker

Ceph Versions and Docker image tags

+

Find available container image tags

curl -sSL https://registry.hub.docker.com/v2/repositories/ceph/daemon/tags/ | jq '."results"[] .name'
+curl -sSL https://registry.hub.docker.com/v2/repositories/ceph/daemon/tags/?page=2 | jq '."results"[] .name'
+
+

Deploy a monitor

docker run -d --net=host \
+-v /etc/ceph:/etc/ceph \
+-v /var/lib/ceph/:/var/lib/ceph/ \
+-e MON_IP=192.168.5.120 \
+-e CEPH_PUBLIC_NETWORK=192.168.5.0/24 \
+ceph/daemon mon
+
+

Deploy a Manager daemon

docker run -d --net=host \
+-v /etc/ceph:/etc/ceph \
+-v /var/lib/ceph/:/var/lib/ceph/ \
+ceph/daemon mgr
+
+

Deploy an OSD

docker run -d --net=host \
+--pid=host \
+--privileged=true \
+-v /etc/ceph:/etc/ceph \
+-v /var/lib/ceph/:/var/lib/ceph/ \
+-v /dev/:/dev/ \
+-e OSD_DEVICE=/dev/vdd \
+-e OSD_TYPE=disk \
+-e OSD_BLUESTORE=1 \
+ceph/daemon osd
+
+

Deploy a MDS

docker run -d --net=host \
+-v /var/lib/ceph/:/var/lib/ceph/ \
+-v /etc/ceph:/etc/ceph \
+-e CEPHFS_CREATE=1 \
+ceph/daemon mds
+
+

Deploy a Rados Gateway

docker run -d --net=host \
+-v /var/lib/ceph/:/var/lib/ceph/ \
+-v /etc/ceph:/etc/ceph \
+ceph/daemon rgw
+
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2018/12/22/distributed-system-design/index.html b/2018/12/22/distributed-system-design/index.html new file mode 100644 index 00000000..e12f3561 --- /dev/null +++ b/2018/12/22/distributed-system-design/index.html @@ -0,0 +1,242 @@ + + + + + + + + + + + + Distributed System Design | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Distributed System Design +

+ +

Distributed System Design

+

The 8 Fallacies of Distributed Systems

    +
  1. The network is reliable.
      +
    • Qutomatically retry
    • +
    • Queuing systems
    • +
    +
  2. +
  3. Latency is zero.
      +
    • bring back all the data you might need
    • +
    • move the data closer to the clients (CDN)
    • +
    • invert the flow of data (Pub/Sub)
    • +
    +
  4. +
  5. Bandwidth is infinite.
      +
    • DDD
    • +
    • CQRS
    • +
    +
  6. +
  7. The network is secure.
      +
    • TLS
    • +
    • DTLS
    • +
    • HTTPS
    • +
    +
  8. +
  9. Topology doesn’t change.
      +
    • DNS
    • +
    • discovery service
    • +
    • Service Bus
    • +
    +
  10. +
  11. There is one administrator.
      +
    • Everyone should be responsible for the release process
    • +
    • Logging and monitoring
    • +
    • Decoupling
    • +
    • Isolate 3rd party dependencies
    • +
    +
  12. +
  13. Transport cost is zero.
      +
    • The cost of the networking infrastructure
    • +
    • The cost of serialization/deserialization
        +
      • SOAP or XML is more expensive than JSON
      • +
      • JSON is more expensive than binary protocols like Google’s Protocol Buffers
      • +
      +
    • +
    +
  14. +
  15. The network is homogeneous.
      +
    • focus on standard protocols.
    • +
    • choose standard formats in order to avoid vendor lock-in
    • +
    +
  16. +
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2018/12/30/manually-generate-the-java-root-certificate/index.html b/2018/12/30/manually-generate-the-java-root-certificate/index.html new file mode 100644 index 00000000..9b2c6a82 --- /dev/null +++ b/2018/12/30/manually-generate-the-java-root-certificate/index.html @@ -0,0 +1,193 @@ + + + + + + + + + + + + Manually generate the Java root certificate | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Manually generate the Java root certificate +

+ +

Manually generate the Java root certificate

1
2
3
# dpkg -l | grep ca-certificates
ii ca-certificates 20161130+nmu1+deb9u1 all Common CA certificates
ii ca-certificates-java 20170929~deb9u3 all Common CA certificates (JKS keystore)
+ +

Shell script

1
2
3
4
5
6
7
8
9
storepass='changeit'
JAR=/usr/share/ca-certificates-java/ca-certificates-java.jar

rm -f /etc/ssl/certs/java/cacerts
find /etc/ssl/certs -name \*.pem | \
while read filename; do
echo "+${filename}"
done | \
java -Xmx64m -jar $JAR -storepass "$storepass"
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2018/12/31/risc-v-program-development-using-qemu/RISC-V_ISA_modularity.png b/2018/12/31/risc-v-program-development-using-qemu/RISC-V_ISA_modularity.png new file mode 100644 index 00000000..4756cd6d Binary files /dev/null and b/2018/12/31/risc-v-program-development-using-qemu/RISC-V_ISA_modularity.png differ diff --git a/2018/12/31/risc-v-program-development-using-qemu/index.html b/2018/12/31/risc-v-program-development-using-qemu/index.html new file mode 100644 index 00000000..252a5605 --- /dev/null +++ b/2018/12/31/risc-v-program-development-using-qemu/index.html @@ -0,0 +1,448 @@ + + + + + + + + + + + + RISC-V program development using QEMU | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ RISC-V program development using QEMU +

+ +

RISC-V

+

In a nutshell

RISC-V (pronounced “risk-five”) is an open source instruction set architecture (ISA) based on +established reduced instruction set computing (RISC) principles.

+

The project began in 2010 at the University of California, Berkeley, but many contributors are +volunteers not affiliated with the university.

+

In contrast to most ISAs, RISC-V is freely available for all types of use, permitting anyone +to design, manufacture and sell RISC-V chips and software. While not the first open ISA, it +is significant because it is designed to be useful in modern computerized devices such as +warehouse-scale cloud computers, high-end mobile phones and the smallest embedded systems. +Such uses demand that the designers consider both performance and power efficiency. The +instruction set also has a substantial body of supporting software, which fixes the usual +weakness of new instruction sets.

+

RISC-V ISA modularity

+

Hardware baseline and ABI choice

There are different versions of the instruction set for 32, 64 and 128 bits; operating as little-endian by default.

+
    +
  • RV32I, most is microcontroller unit (MCU) class RV32IMC
  • +
  • RV32E, for embedded systems
  • +
  • RV64I, most Linux distro use RV64GC as the hardware baseline and the lp64d ABI (little-endian, the default ABI for RV64G systems).
  • +
  • RV128I, simply not realistic at this time.
  • +
+

The base set of RISC-V is the Base Integer Instruction Set “RV32/64/128I” or “RV32E” (a reduced version of RV32I that supports only 16 registers designed for embedded systems).

+

A computer with the instruction sets “IMAFD”, is said to be “general-purpose”, summarized as “G”, so it an “RV64IMAFDC” can also be described as an “RV64GC”. Together with the “privileged” instruction set extension an “RVGC” defines all instructions needed to conveniently support a Unix-style operating system.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ExtensionDescriptionVersionFrozen?
MStandard Extension for Integer Multiplication and Division2.0Yes
AStandard Extension for Atomic Instructions2.0Yes
FStandard Extension for Single-Precision Floating-Point2.0Yes
DStandard Extension for Double-Precision Floating-Point2.0Yes
QStandard Extension for Quad-Precision Floating-Point2.0Yes
CStandard Extension for Compressed Instructions2.0Yes
LStandard Extension for Decimal Floating-Point0.0No
BStandard Extension for Bit Manipulation0.0No
JStandard Extension for Dynamically Translated Languages0.0No
TStandard Extension for Transactional Memory0.0No
PStandard Extension for Packed-SIMD Instructions0.1No
VStandard Extension for Vector Operations0.2No
NStandard Extension for User-Level Interrupts1.1No
+

Qemu setup

install packages

sudo apt install qemu-system-misc qemu-user-static binfmt-support u-boot-qemu opensbi libc6-riscv64-cross gcc-riscv64-linux-gnu
+
+sudo ln -s /usr/riscv64-linux-gnu/lib/ld-linux-riscv64-lp64d.so.1 /lib
+
+sudo sh -c "cat >/etc/ld.so.conf.d/riscv64-linux-gnu.conf << EOF
+/usr/riscv64-linux-gnu/lib/
+EOF
+"
+
+LD_LIBRARY_PATH=/usr/riscv64-linux-gnu/lib qemu-riscv64-static a.out
+
+/usr/bin/qemu-system-riscv64
+/usr/lib/riscv64-linux-gnu/opensbi/qemu/virt/fw_dynamic.elf
+/usr/lib/riscv64-linux-gnu/opensbi/qemu/virt/fw_jump.elf
+/usr/lib/u-boot/qemu-riscv64_smode/u-boot.bin
+
+

register riscv64 interpreter

sudo update-binfmts --import << EOF
+package qemu-user-static
+interpreter /usr/bin/qemu-riscv64-static
+type magic
+offset 0
+magic \x7f\x45\x4c\x46\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xf3\x00
+mask  \xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff
+EOF
+
+

Setting up a riscv64 virtual machine

debootstrap of riscv64

sudo apt-get install debootstrap qemu-user-static binfmt-support debian-ports-archive-keyring
+sudo debootstrap --arch=riscv64 --keyring /usr/share/keyrings/debian-ports-archive-keyring.gpg \
+    --include=curl,jq,wget,locales,debian-ports-archive-keyring --merged-usr --foreign \
+    unstable /tmp/riscv64-chroot http://deb.debian.org/debian-ports
+
+sudo chroot /tmp/riscv64-chroot
+
+cat > /debootstrap/mirror << EOF
+http://deb.debian.org/debian-ports
+EOF
+
+/debootstrap/debootstrap --second-stage
+
+localedef -c -i en_US -f UTF-8 en_US.UTF-8
+localedef -c -i zh_CN -f UTF-8 zh_CN.UTF-8
+localedef --list-archive
+
+passwd
+
+ln -sf /dev/null /etc/systemd/system/serial-getty@hvc0.service
+
+cat > /etc/resolv.conf << EOF
+nameserver 1.1.1.1
+nameserver 8.8.8.8
+EOF
+
+cat > /etc/apt/apt.conf.d/zz-10-install << EOF
+APT::Install-Recommends "0";
+APT::Install-Suggests "0";
+
+Acquire::http { Proxy "http://proxy.example.com:8080"; };
+EOF
+
+cat > /etc/apt/sources.list << EOF
+deb http://ftp.ports.debian.org/debian-ports unstable main
+# deb http://ftp.ports.debian.org/debian-ports unreleased main
+# deb http://ftp.ports.debian.org/debian-ports experimental main
+EOF
+
+apt-get update
+apt-get install --no-install-recommends linux-image-riscv64 u-boot-menu openntpd ntpdate
+sed -i 's/^DAEMON_OPTS="/DAEMON_OPTS="-s /' /etc/default/openntpd
+
+cat >> /etc/default/u-boot <<EOF
+U_BOOT_PARAMETERS="rw noquiet root=/dev/vda1"
+EOF
+
+u-boot-update
+
+cat >> /etc/network/interfaces <<EOF
+auto lo
+iface lo inet loopback
+
+auto eth0
+iface eth0 inet dhcp
+EOF
+
+

Create rootfs.img

truncate -s 4G rootfs.img
+losetup --find rootfs.img
+losetup -a
+
+fdisk /dev/loop0
+partprobe -s /dev/loop0
+mkswap /dev/loop0p2
+mkfs.ext4 /dev/loop0p1
+
+mount /dev/loop0p1 riscv64-root/
+cp -aP riscv64-chroot/* riscv64-root/
+
+losetup --detach /dev/loop0
+
+

Run qemu-system-riscv64

# qemu-system-riscv64 -nographic -machine virt -m 1.9G \
+    -kernel /usr/lib/riscv64-linux-gnu/opensbi/qemu/virt/fw_jump.elf \
+    -device loader,file=/usr/lib/u-boot/qemu-riscv64_smode/u-boot.bin,addr=0x80200000 \
+    -object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-device,rng=rng0 \
+    -append "console=ttyS0 rw root=/dev/vda1" \
+    -device virtio-blk-device,drive=hd0 -drive file=rootfs.img,format=raw,id=hd0 \
+    -device virtio-net-device,netdev=usernet -netdev user,id=usernet,hostfwd=tcp::22222-:22
+
+# qemu-system-riscv64 -nographic -machine virt -m 1.9G \
+    -kernel /usr/lib/riscv64-linux-gnu/opensbi/qemu/virt/fw_jump.elf \
+    -object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-device,rng=rng0 \
+    -append "root=/dev/vda1 ro console=ttyS0" \
+    -device virtio-blk-device,drive=hd0 -drive file=rootfs.img,format=raw,id=hd0 \
+    -device virtio-net-device,netdev=net0 -netdev type=tap,id=net0,ifname=tap0,script=no,downscript=no
+
+    ip link add br0 type bridge
+    ip tuntap add dev tap0 mode tap user $(whoami)
+    ip link set dev tap0 master br0
+  # ip addr flush dev eth0
+  # ip link set dev eth0 master br0
+    ip link set dev br0 up
+    ip link set dev tap0 up
+
+  # ip address delete $PREFIX dev eth0
+  # ip address add $PREFIX dev br0
+  # ip route add default via $ROUTE dev br0
+
+qemu-system-riscv64: plic: invalid register write: 000001fc
+
+Platform Name          : QEMU Virt Machine
+Platform HART Features : RV64ACDFIMSU
+Platform Max HARTs     : 8
+Current Hart           : 0
+Firmware Base          : 0x80000000
+Firmware Size          : 112 KB
+Runtime SBI Version    : 0.1
+
+PMP0: 0x0000000080000000-0x000000008001ffff (A)
+PMP1: 0x0000000000000000-0xffffffffffffffff (A,R,W,X)
+
+CPU:   rv64imafdcsu
+Model: riscv-virtio,qemu
+DRAM:  1.9 GiB
+
+date -s -d'2018-05-07T21:28:57'
+date -u [MMDDhhmm[[CC]YY][.ss]]
+date -u 123109322018
+
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2019/01/01/kubernetes-api-reference/index.html b/2019/01/01/kubernetes-api-reference/index.html new file mode 100644 index 00000000..43a74f55 --- /dev/null +++ b/2019/01/01/kubernetes-api-reference/index.html @@ -0,0 +1,288 @@ + + + + + + + + + + + + Kubernetes API Reference | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Kubernetes API Reference +

+ +

Kubernetes API Reference

You can use the Kubernetes API to read and write Kubernetes resource objects via a Kubernetes API endpoint.

+ +

API overview

Resource Categories

This is a high-level overview of the basic types of resources provide by the Kubernetes API and their primary functions.

+
    +
  • Workloads are objects you use to manage and run your containers on the cluster.
  • +
  • Discovery & LB resources are objects you use to “stitch” your workloads together into an externally accessible, load-balanced Service.
  • +
  • Config & Storage resources are objects you use to inject initialization data into your applications, and to persist data that is external to your container.
  • +
  • Cluster resources objects define how the cluster itself is configured; these are typically used only by cluster operators.
  • +
  • Metadata resources are objects you use to configure the behavior of other resources within the cluster, such as HorizontalPodAutoscaler for scaling workloads.
  • +
+

Resource Objects

Resource objects typically have 3 components:

+
    +
  • Resource ObjectMeta: This is metadata about the resource, such as its name, type, api version, annotations, and labels. This contains fields that maybe updated both by the end user and the system (e.g. annotations).
  • +
  • ResourceSpec: This is defined by the user and describes the desired state of system. Fill this in when creating or updating an object.
  • +
  • ResourceStatus: This is filled in by the server and reports the current state of the system. In most cases, users don’t need to change this.
  • +
+

Resource Operations

Most resources provide the following Operations:

+
    +
  • Create + Create operations will create the resource in the storage backend. After a resource is create the system will apply the desired state.

    +
  • +
  • Update + Updates come in 2 forms: Replace and Patch:

    +
      +
    • Replace: Replacing a resource object will update the resource by replacing the existing spec with the provided one.
    • +
    • Patch: Patch will apply a change to a specific field. How the change is merged is defined per field. Lists may either be replaced or merged. Merging lists will not preserve ordering.
    • +
    +
  • +
  • Read + Reads come in 3 forms: Get, List and Watch:

    +
      +
    • Get: Get will retrieve a specific resource object by name.
    • +
    • List: List will retrieve all resource objects of a specific type within a namespace, and the results can be restricted to resources matching a selector query. +List All Namespaces: Like List but retrieves resources across all namespaces.
    • +
    • Watch: Watch will stream results for an object(s) as it is updated. Similar to a callback, watch is used to respond to resource changes.
    • +
    +
  • +
  • Delete + Delete will delete a resource. Depending on the specific resource, child objects may or may not be garbage collected by the server. See notes on specific resource objects for details.

    +
  • +
  • Additional Operations + Resources may define additional operations specific to that resource type.

    +
      +
    • Rollback: Rollback a PodTemplate to a previous version. Only available for some resource types.
    • +
    • Read / Write Scale: Read or Update the number of replicas for the given resource. Only available for some resource types.
    • +
    • Read / Write Status: Read or Update the Status for a resource object. The Status can only changed through these update operations.
    • +
    +
  • +
+

Workloads APIs

    +
  • Container v1 core
  • +
  • CronJob v1beta1 batch
  • +
  • DaemonSet v1 apps
  • +
  • Deployment v1 apps
  • +
  • Job v1 batch
  • +
  • Pod v1 core
  • +
  • ReplicaSet v1 apps
  • +
  • ReplicationController v1 core
  • +
  • StatefulSet v1 apps
  • +
+

Service APIs

    +
  • Endpoints v1 core
  • +
  • Ingress v1beta1 extensions
  • +
  • Service v1 core
  • +
+

Config and Storage APIs

    +
  • ConfigMap v1 core
  • +
  • Secret v1 core
  • +
  • PersistentVolumeClaim v1 core
  • +
  • StorageClass v1 storage.k8s.io
  • +
  • Volume v1 core
  • +
  • VolumeAttachment v1beta1 storage.k8s.io
  • +
+

Metadata APIs

    +
  • Event v1 core
  • +
  • LimitRange v1 core
  • +
  • PodTemplate v1 core
  • +
  • HorizontalPodAutoscaler v1 autoscaling
  • +
  • +
+

Cluster APIs

    +
  • Binding v1 core
  • +
  • ClusterRole v1 rbac.authorization.k8s.io
  • +
  • ClusterRoleBinding v1 rbac.authorization.k8s.io
  • +
  • Namespace v1 core
  • +
  • Node v1 core
  • +
  • PersistentVolume v1 core
  • +
  • ResourceQuota v1 core
  • +
  • Role v1 rbac.authorization.k8s.io
  • +
  • RoleBinding v1 rbac.authorization.k8s.io
  • +
  • ServiceAccount v1 core
  • +
  • +
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2019/01/05/helm-template-random-value/index.html b/2019/01/05/helm-template-random-value/index.html new file mode 100644 index 00000000..80f8da75 --- /dev/null +++ b/2019/01/05/helm-template-random-value/index.html @@ -0,0 +1,209 @@ + + + + + + + + + + + + Helm Template random value | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Helm Template random value +

+ +

Helm Template random value

Sprig Function Documentation

The Sprig library provides over 70 template functions for Go’s template language.

+ +

Random functions

These four functions generate cryptographically secure random strings, but with different base character sets:

+
    +
  • randAlphaNum uses 0-9a-zA-Z
  • +
  • randAlpha uses a-zA-Z
  • +
  • randNumeric uses 0-9
  • +
  • randAscii uses all printable ASCII characters
  • +
+

Each of them takes one parameter: the integer length of the string. +e.g. This will produce a random string with 12 ASCII characters.

+
randAscii 12
+
+

Using in the Helm template

values.yaml

data_with_rand_value: 'abcd-{{ randAlphaNum 12 }}'
+
+

templates/

data_with_rand_value: {{ tpl .Values.data_with_rand_value . | quote }}
+
+

random result

data_with_rand_value: "abcd-jXf7OWkGpRH2"
+
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2019/01/12/nghttpx-http-proxy/index.html b/2019/01/12/nghttpx-http-proxy/index.html new file mode 100644 index 00000000..b3168537 --- /dev/null +++ b/2019/01/12/nghttpx-http-proxy/index.html @@ -0,0 +1,235 @@ + + + + + + + + + + + + nghttpx http proxy | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ nghttpx http proxy +

+ +

nghttpx http proxy

+

TLS encryption

    +
  1. The frontend connections are encrypted with SSL/TLS by default.

    +
     frontend=*,443
    + frontend=*,80;no-tls
    +
    +
  2. +
  3. The TLS encryption is now disabled on backend connection in all modes by default.

    +
     backend=127.0.0.1,8080;tls
    +
    +
  4. +
+

HTTP protocol

    +
  1. The default backend protocol is HTTP/1.1
  2. +
  3. HTTP/2 and HTTP/1 are available on the frontend, and an HTTP/1 connection can be upgraded to HTTP/2 using HTTP Upgrade. Starting HTTP/2 connection by sending HTTP/2 connection preface is also supported.
  4. +
+

Session affinity

Two kinds of session affinity are available: client IP, and HTTP Cookie.

+

To enable client IP based affinity, specify affinity=ip parameter in –backend option.

+
backend=127.0.0.1,3000;;affinity=ip
+
+

To enable HTTP Cookie based affinity, specify affinity=cookie parameter, and specify a name of cookie in affinity-cookie-name parameter. Optionally, a Path attribute can be specified in affinity-cookie-path parameter:

+
backend=127.0.0.1,3000;;affinity=cookie;affinity-cookie-name=nghttpxlb;affinity-cookie-path=/
+
+

HTTP proxy

proxy patterns

nghttpx can route request to different backend according to request host and path.

+
# they are used as load balancing
+backend=192.168.0.10,8080
+backend=192.168.0.11,8008
+
+backend=docserv,3000;doc.example.com/
+backend=::1,8080;/bar/
+backend=::1,8080;/sample*
+backend=192.168.0.10,8080;example.com/foo
+
+# they are used as load balancing
+backend=serv1,3000;example.com/myservice
+backend=serv2,3000;example.com/myservice
+
+backend=serv1,3000;/;proto=h2
+backend=serv1,3000;/ws/;proto=http/1.1
+
+backend=serv1,8443;/;proto=h2;tls
+backend=serv2,8080;/ws/;proto=http/1.1
+
+

catch all pattern

One important thing you have to remember is that we have to specify default routing pattern for so called “catch all” pattern. To write “catch all” pattern, just specify backend server address, without pattern.

+

Usually, host is the value of Host header field. In HTTP/2, the value of :authority pseudo header field is used.

+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2019/01/19/circular-dependencies-in-spring/index.html b/2019/01/19/circular-dependencies-in-spring/index.html new file mode 100644 index 00000000..2c691f1f --- /dev/null +++ b/2019/01/19/circular-dependencies-in-spring/index.html @@ -0,0 +1,213 @@ + + + + + + + + + + + + Circular Dependencies in Spring | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Circular Dependencies in Spring +

+ +

Circular Dependencies in Spring

What Happens in Spring

When Spring context is loading all the beans, it tries to create beans in the order needed for them to work completely.

+

When having a circular dependency, Spring cannot decide which of the beans should be created first, since they depend on one another. In these cases, Spring will raise a BeanCurrentlyInCreationException while loading context.

+

It can happen in Spring when using constructor injection; if you use other types of injections you should not find this problem since the dependencies will be injected when they are needed and not on the context loading.

+

The Workarounds

    +
  1. Redesign

    +

    When you have a circular dependency, it’s likely you have a design problem and the responsibilities are not well separated. You should try to redesign the components properly so their hierarchy is well designed and there is no need for circular dependencies.

    +
  2. +
  3. Use @Lazy

    +

    A simple way to break the cycle is saying Spring to initialize one of the beans lazily. That is: instead of fully initializing the bean, it will create a proxy to inject it into the other bean. The injected bean will only be fully created when it’s first needed.

    +
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    @Component
    public class CircularDependencyA {

    private CircularDependencyB circB;

    @Autowired
    public CircularDependencyA(@Lazy CircularDependencyB circB) {
    this.circB = circB;
    }
    }
    +
  4. +
  5. Use Setter/Field Injection

    +

    One of the most popular workarounds, and also what Spring documentation proposes, is using setter injection.

    +

    Simply put if you change the ways your beans are wired to use setter injection (or field injection) instead of constructor injection – that does address the problem. This way Spring creates the beans, but the dependencies are not injected until they are needed.

    +
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    @Component
    public class CircularDependencyA {

    private CircularDependencyB circB;

    @Autowired
    public void setCircB(CircularDependencyB circB) {
    this.circB = circB;
    }

    public CircularDependencyB getCircB() {
    return circB;
    }
    }

    @Component
    public class CircularDependencyB {

    private CircularDependencyA circA;

    private String message = "Hi!";

    @Autowired
    public void setCircA(CircularDependencyA circA) {
    this.circA = circA;
    }

    public String getMessage() {
    return message;
    }
    }
    +
  6. +
  7. Use @PostConstruct

    +

    Another way to break the cycle is injecting a dependency using @Autowired on one of the beans, and then use a method annotated with @PostConstruct to set the other dependency.

    +
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    @Component
    public class CircularDependencyA {

    @Autowired
    private CircularDependencyB circB;

    @PostConstruct
    public void init() {
    circB.setCircA(this);
    }

    public CircularDependencyB getCircB() {
    return circB;
    }
    }

    @Component
    public class CircularDependencyB {

    private CircularDependencyA circA;

    private String message = "Hi!";

    public void setCircA(CircularDependencyA circA) {
    this.circA = circA;
    }

    public String getMessage() {
    return message;
    }
    }
    +
  8. +
  9. Implement ApplicationContextAware and InitializingBean

    +

    If one of the beans implements ApplicationContextAware, the bean has access to Spring context and can extract the other bean from there. Implementing InitializingBean we indicate that this bean has to do some actions after all its properties have been set; in this case, we want to manually set our dependency.

    +
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    @Component
    public class CircularDependencyA implements ApplicationContextAware, InitializingBean {

    private CircularDependencyB circB;

    private ApplicationContext context;

    public CircularDependencyB getCircB() {
    return circB;
    }

    @Override
    public void afterPropertiesSet() throws Exception {
    circB = context.getBean(CircularDependencyB.class);
    }

    @Override
    public void setApplicationContext(final ApplicationContext ctx) throws BeansException {
    context = ctx;
    }
    }

    @Component
    public class CircularDependencyB {

    private CircularDependencyA circA;

    private String message = "Hi!";

    @Autowired
    public void setCircA(CircularDependencyA circA) {
    this.circA = circA;
    }

    public String getMessage() {
    return message;
    }
    }
  10. +
+

In Conclusion

There are many ways to deal with circular dependencies in Spring. The first thing to consider is to redesign your beans so there is no need for circular dependencies: they are usually a symptom of a design that can be improved.

+

But if you absolutely need to have circular dependencies in your project, you can follow some of the workarounds suggested here.

+

The preferred method is using setter injections. But there are other alternatives, generally based on stopping Spring from managing the initialization and injection of the beans, and doing that yourself using one strategy or another.

+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2019/01/26/ansi-escape-sequences-colors/index.html b/2019/01/26/ansi-escape-sequences-colors/index.html new file mode 100644 index 00000000..a5b09f39 --- /dev/null +++ b/2019/01/26/ansi-escape-sequences-colors/index.html @@ -0,0 +1,279 @@ + + + + + + + + + + + + ANSI Escape Sequences Colors | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ ANSI Escape Sequences Colors +

+ +

ANSI Escape Sequences Colors

ANSI escape sequences are non-printed text that is interpreted to change the format of some text. These can be used to beautify terminal prompts, text, or anything else that understands ANSI escape sequences.

+

Add colors to the prompt

Sequences have different lengths. All sequences start with ESC (27 / hex 0x1B / oct 033), followed by a second byte in the range 0x40–0x5F (ASCII @A–Z[]^_). +Colors must be followed by a m. The next part is the 1 preceding the actual color code. This indicates whether or not the color should be bold or not (0 for normal, 1 for bold).

+

To add colors to the shell prompt use the following export command syntax:

+
'\e[x;ym $PS1 \e[m'
+
+

Where,

+
    +
  1. \e[ : Start color scheme.
  2. +
  3. x;y : Color pair to use (x;y)
  4. +
  5. $PS1 : Your shell prompt variable.
  6. +
  7. \e[m : Stop color scheme.
  8. +
+

To set a red color prompt, type the following command:

+
export PS1="\e[0;31m[\u@\h: \w]\$ \e[m "
+
+

You can also use tput command to set terminal and modify the prompt settings. For example, to display RED color prompt using a tput:

+
export PS1="\[$(tput setaf 1)\][\u@\h:\w] $ \[$(tput sgr0)\]"
+
+

Basic color codes listing

Black      0;30       Dark Gray    1;30
+Red        0;31       Bold Red     1;31
+Green      0;32       Bold Green   1;32
+Yellow     0;33       Bold Yellow  1;33
+Blue       0;34       Bold Blue    1;34
+Purple     0;35       Bold Purple  1;35
+Cyan       0;36       Bold Cyan    1;36
+Light Gray 0;37       White        1;37
+
+

A list of handy tput command line options

    +
  • tput bold – Bold effect
  • +
  • tput rev – Display inverse colors
  • +
  • tput sgr0 – Reset everything
  • +
  • tput setaf {CODE}– Set foreground color, see color {CODE} table below for more information.
  • +
  • tput setab {CODE}– Set background color, see color {CODE} table below for more information.
  • +
+

Basic color codes for the tput command

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Color {code}Color
0Black
1Red
2Green
3Yellow
4Blue
5Magenta
6Cyan
7White
+

Color variables

export COLOR_NC='\e[0m' # No Color
+export COLOR_WHITE='\e[1;37m'
+export COLOR_BLACK='\e[0;30m'
+export COLOR_BLUE='\e[0;34m'
+export COLOR_LIGHT_BLUE='\e[1;34m'
+export COLOR_GREEN='\e[0;32m'
+export COLOR_LIGHT_GREEN='\e[1;32m'
+export COLOR_CYAN='\e[0;36m'
+export COLOR_LIGHT_CYAN='\e[1;36m'
+export COLOR_RED='\e[0;31m'
+export COLOR_LIGHT_RED='\e[1;31m'
+export COLOR_PURPLE='\e[0;35m'
+export COLOR_LIGHT_PURPLE='\e[1;35m'
+export COLOR_BROWN='\e[0;33m'
+export COLOR_YELLOW='\e[1;33m'
+export COLOR_GRAY='\e[0;30m'
+export COLOR_LIGHT_GRAY='\e[0;37m'
+
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2019/02/04/4-1-architectural-view-model/4+1_Architectural_View_Model.svg b/2019/02/04/4-1-architectural-view-model/4+1_Architectural_View_Model.svg new file mode 100644 index 00000000..6b8f6aea --- /dev/null +++ b/2019/02/04/4-1-architectural-view-model/4+1_Architectural_View_Model.svg @@ -0,0 +1,538 @@ + + + + + 4+1 Architectural View Model + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + 4+1 Architectural View Model + 2016/07/14 + + + mpan (<https://mpan.pl/>) + + + + + mpan (<https://mpan.pl/>) + + + English + Based on <https://commons.wikimedia.org/wiki/File:4%2B1_Architectural_View_Model.jpg> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Logicalview + Developmentview + Processview + Physicalview + Scenarios + + + + + + + + + + + + + + + + System& environment + + diff --git a/2019/02/04/4-1-architectural-view-model/4+1_Architectural_View_Model.svg.png b/2019/02/04/4-1-architectural-view-model/4+1_Architectural_View_Model.svg.png new file mode 100644 index 00000000..94f4a305 Binary files /dev/null and b/2019/02/04/4-1-architectural-view-model/4+1_Architectural_View_Model.svg.png differ diff --git a/2019/02/04/4-1-architectural-view-model/index.html b/2019/02/04/4-1-architectural-view-model/index.html new file mode 100644 index 00000000..adafc713 --- /dev/null +++ b/2019/02/04/4-1-architectural-view-model/index.html @@ -0,0 +1,198 @@ + + + + + + + + + + + + 4+1 Architectural View Model | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ 4+1 Architectural View Model +

+ +

4+1 Architectural View Model

4+1 is a view model designed by Philippe Kruchten for “describing the architecture of software-intensive systems, based on the use of multiple, concurrent views”. The views are used to describe the system from the viewpoint of different stakeholders, such as end-users, developers, system engineer, and project managers. The four views of the model are logical, development, process and physical view. In addition selected use cases or scenarios are used to illustrate the architecture serving as the ‘plus one’ view. Hence the model contains 4+1 views:

+

4+1 Architectural View Model

+

Logical view

The logical view is concerned with the functionality that the system provides to end-users. UML diagrams are used to represent the logical view, and include class diagrams, and state diagrams.

+

Process view

The process view deals with the dynamic aspects of the system, explains the system processes and how they communicate, and focuses on the runtime behavior of the system. The process view addresses concurrency, distribution, integrators, performance, and scalability, etc. UML diagrams to represent process view include the activity diagram.

+

Development view

The development view illustrates a system from a programmer’s perspective and is concerned with software management. This view is also known as the implementation view. It uses the UML Component diagram to describe system components. UML Diagrams used to represent the development view include the Package diagram.

+

Physical view

The physical view depicts the system from a system engineer’s point of view. It is concerned with the topology of software components on the physical layer as well as the physical connections between these components. This view is also known as the deployment view. UML diagrams used to represent the physical view include the deployment diagram.

+

Scenarios

The description of an architecture is illustrated using a small set of use cases, or scenarios, which become a fifth view. The scenarios describe sequences of interactions between objects and between processes. They are used to identify architectural elements and to illustrate and validate the architecture design. They also serve as a starting point for tests of an architecture prototype. This view is also known as the use case view.

+

In Conclusion

The 4+1 view model is generic and is not restricted to any notation, tool or design method. Quoting Kruchten,

+
+

The “4+1” view model is rather “generic”: other notations and tools can be used, other design methods can be used, especially for the logical and process decompositions, but we have indicated the ones we have used with success. + — Philippe Kruchten, Architectural Blueprints—The “4+1” View Model of Software Architecture

+
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2019/02/05/docker-authentication-information-in-the-kubernetes-secret/index.html b/2019/02/05/docker-authentication-information-in-the-kubernetes-secret/index.html new file mode 100644 index 00000000..210d9968 --- /dev/null +++ b/2019/02/05/docker-authentication-information-in-the-kubernetes-secret/index.html @@ -0,0 +1,196 @@ + + + + + + + + + + + + Docker authentication information in the Kubernetes secret | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Docker authentication information in the Kubernetes secret +

+ +

Docker authentication information in the Kubernetes secret

When pull an image from a private registry, we need put docker config.json file in the Kubernetes secret, and use it by Kubernetes imagePullSecrets.

+

Docker config.json

The docker login process creates or updates a config.json file that holds an authorization token.

+
1
2
3
4
5
6
7
8
9
10
# docker login
# cat ~/.docker/config.json
{
"auths": {
"https://index.docker.io/v1/": {
"auth": "c3R...zE2"
},
...
}
}
+ +

Create Kubernetes secret via docker config.json

1
2
3
kubectl create secret generic armdocker \
--from-file=.dockerconfigjson=config.json \
--type=kubernetes.io/dockerconfigjson
+ +

Create Kubernetes secret via docker username and password

1
2
3
4
kubectl create secret docker-registry armdocker \
--docker-server=<your-registry-server> \
--docker-username=<your-name> \
--docker-password=<your-pword>
+ +

Inspecting the Secret

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# kubectl get secret armdocker --output=yaml

apiVersion: v1
kind: Secret
metadata:
...
name: armdocker
...
data:
.dockerconfigjson: eyJodHRwczovL2luZGV4L ... J0QUl6RTIifX0=
type: kubernetes.io/dockerconfigjson

# kubectl get secret armdocker --output="jsonpath={.data.\.dockerconfigjson}" | base64 --decode| jq

{
"auths": {
"your.private.registry.example.com": {
"username": "janedoe",
"password": "xxxxxxxxxxx",
"email": "jdoe@example.com",
"auth": "c3R...zE2"
}
}
}
+ +

Use Kubernetes secret of docker registry

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
apiVersion: apps/v1
kind: Deployment
metadata:
name: sample-of-docker-registry-secret
spec:
template:
spec:
restartPolicy: Always
imagePullSecrets:
- name: armdocker
initContainers:
- name: wait-for-precondition
image: <your-private-image>
imagePullPolicy: Always
containers:
- name: sample-service-name
image: <your-private-image>
imagePullPolicy: Always
+
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2019/02/09/moving-average/index.html b/2019/02/09/moving-average/index.html new file mode 100644 index 00000000..f96dd736 --- /dev/null +++ b/2019/02/09/moving-average/index.html @@ -0,0 +1,201 @@ + + + + + + + + + + + + Moving average | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Moving average +

+ +

Moving average

In statistics, a moving average (rolling average or running average) is a calculation to analyze data points by creating a series of averages of different subsets of the full data set. It is also called a moving mean (MM) or rolling mean and is a type of finite impulse response filter. Variations include: simple, and cumulative, or weighted forms.

+

Given a series of numbers and a fixed subset size, the first element of the moving average is obtained by taking the average of the initial fixed subset of the number series. Then the subset is modified by “shifting forward”; that is, excluding the first number of the series and including the next value in the subset.

+

A moving average is commonly used with time series data to smooth out short-term fluctuations and highlight longer-term trends or cycles. The threshold between short-term and long-term depends on the application, and the parameters of the moving average will be set accordingly.

+

Variations

    +
  • MA: moving average
  • +
  • SMA: simple moving average
  • +
  • LWMA: linearly weighted moving average
  • +
  • EMA: exponential moving average
  • +
  • DEMA: double exponential moving average
  • +
  • TEMA: triple exponential moving average
  • +
  • DMA: displaced moving average
  • +
+

Sample coding

EMA

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
class ExponentialMovingAverage {
private double alpha;
private Double oldValue;
public ExponentialMovingAverage(double alpha) {
this.alpha = alpha;
}

public double average(double value) {
if (oldValue == null) {
oldValue = value;
return value;
}
double newValue = oldValue + alpha * (value - oldValue);
oldValue = newValue;
return newValue;
}
}
+ +

Time windowed EMA

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/**
* An exponentially weighted moving average implementation that decays based on the elapsed time since the last update,
* approximating a time windowed moving average.
*/
public class MovingAverage {
private final long windowNanos;

// Mutable state
private volatile long lastNanos;
private volatile double average;

/**
* Creates a moving average of samples over a {@code window} for the {@code timeUnit}.
*/
public MovingAverage(long window, TimeUnit timeUnit) {
this.windowNanos = timeUnit.toNanos(window);
}

/**
* Updates the average with the {@code sample}.
*/
public synchronized void update(double sample) {
long now = System.nanoTime();

if (lastNanos == 0) {
average = sample;
lastNanos = now;
return;
}

long elapsedNanos = now - lastNanos;
double coeff = Math.exp(-1.0 * ((double) elapsedNanos / windowNanos));
average = (1.0 - coeff) * sample + coeff * average;
lastNanos = now;
}

/**
* Returns the moving average.
*/
public double get() {
return average;
}

/**
* Tick the internal moving average clock back by the {@code duration}. Useful for testing.
*/
void tick(long duration, TimeUnit timeUnit) {
if (lastNanos != 0)
lastNanos -= timeUnit.toNanos(duration);
}
}
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2019/02/16/cmcc-ipv6/index.html b/2019/02/16/cmcc-ipv6/index.html new file mode 100644 index 00000000..534e4e0c --- /dev/null +++ b/2019/02/16/cmcc-ipv6/index.html @@ -0,0 +1,235 @@ + + + + + + + + + + + + CMCC IPv6 | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ CMCC IPv6 +

+ +

CMCC IPv6

广州移动已经支持 IPv6,但是需要自己配置。此外,你使用的无线路由器也需要支持 IPv6 (广州移动光猫内置的 WiFi 虽然测速只有 30M,但是支持 IPv6),或者退而求其次,支持路由模式。

+

现在无线路由器已经是阻断 IPv6 进入家庭的最后一个拦路虎。常见的家用路由器大多数不支持 IPv6,国内厂家只有华为和小米支持 IPv6,像腾达、TP-Link 和水星都不支持 IPv6。当然,等你看到本文时,情况可能有所改变,详见厂家的说明书。

+

现在有 2 种 IPv6 的配置方案:

+
    +
  1. PPP 模式,即路由模式。配置光猫的 INTERNET 连接模式为 PPP,协议为 IPv4/v6,再配置 LAN 侧地址,启用 DHCP 服务。外置路由器的 WAN 接到光猫的 LAN 侧,使用路由模式接入公网。
  2. +
  3. Bridge 模式,即桥接模式。配置光猫的 INTERNET 连接模式为 Bridge,协议为 IPv4/v6。外置路由器的 WAN 接到光猫的 LAN 侧,使用 PPPoE 拨号模式接入公网。
  4. +
+

第一种方案简便易行,即使你的无线路由器不支持 IPv6,也可以同时接入 IPv4 和 IPv6 网络。但是你的无线路由器的访问控制等高级功能就基本废弃了。

+

第二种方案需要采购支持 IPv6 的中高端无线路由器,但是它的网络延迟小,是对网络延迟敏感的高端用户的必然选择,例如重度游戏玩家,高频交易用户等。

+

配置光猫

登录光猫管理界面,打开“网络->宽带配置”页面,在链接名称的下拉框中,选择类似“6_INTERNET_R_VIF_41”的项目,截图保存后删除。

+

然后在链接名称的下拉框中,选择“新建WAN连接”,IP协议版本选择“IPv4/v6”,根据你的实际情况选择“PPP”或者“Bridge”模式,VLAN 模式和 VLAN ID 根据截图保存的信息填写。在“PPP”模式中,MTU 填写 1492,用户名和密码根据安装的业务单填写,全局地址获取方式选择“AutoConfigured(SLAAC)”,网关获取方式选择“自适应”,DNS 获取方式和前缀获取方式填写“DHCPv6”。

+

PPP 模式,即路由模式 +Bridge 模式,即桥接模式

+

IPv6 状态

登录光猫管理界面,打开“状态->网络侧信息->IPv6连接信息”页面,可以看到当前的 IPv6 连接信息。一般光猫地址是 “/64”,前缀是 “/60”,与国外的 “/56”,乃至 “/48” 相比,可见我国 IPv6 地址的紧缺。

+

IPv6 状态

+

配置路由器

    +
  1. 如果你的无线路由器支持 IPv6,那么根据配置向导的指示,填写用户名和密码,其它使用默认值即可。
  2. +
  3. 如果你的无线路由器不支持 IPv6,但是支持路由模式,就忍痛把它当普通路由器使用,忘记那些高级功能吧。
  4. +
  5. 如果你的无线路由器既不支持 IPv6 又不支持路由模式,那么就把它扔了吧:-),或者启用光猫内置的无线路由器,体验一下最高 30M 网速的 IPv6 网络。
  6. +
+

漫游 IPv6

广州移动的 IPv6 网络延迟还是比 IPv4 大得多,亟需改进。从路由跟踪结果来看,IPv6 比 IPv4 少了 4 跳,但是路由不同,延迟大了近 90 ms,还有很大的优化空间。

+

RTT of IPv4

C:\>ping -4 ipv6.com
+
+正在 Ping ipv6.com [192.185.167.252] 具有 32 字节的数据:
+来自 192.185.167.252 的回复: 字节=32 时间=248ms TTL=42
+来自 192.185.167.252 的回复: 字节=32 时间=294ms TTL=43
+来自 192.185.167.252 的回复: 字节=32 时间=245ms TTL=43
+来自 192.185.167.252 的回复: 字节=32 时间=246ms TTL=41
+
+192.185.167.252 的 Ping 统计信息:
+    数据包: 已发送 = 4,已接收 = 4,丢失 = 0 (0% 丢失),
+往返行程的估计时间(以毫秒为单位):
+    最短 = 245ms,最长 = 294ms,平均 = 258ms
+
+

RTT of IPv6

C:\>ping -6 ipv6.com
+
+正在 Ping ipv6.com [2604:7c00:18:e::2] 具有 32 字节的数据:
+来自 2604:7c00:18:e::2 的回复: 时间=333ms
+来自 2604:7c00:18:e::2 的回复: 时间=329ms
+来自 2604:7c00:18:e::2 的回复: 时间=330ms
+来自 2604:7c00:18:e::2 的回复: 时间=330ms
+
+2604:7c00:18:e::2 的 Ping 统计信息:
+    数据包: 已发送 = 4,已接收 = 4,丢失 = 0 (0% 丢失),
+往返行程的估计时间(以毫秒为单位):
+    最短 = 329ms,最长 = 333ms,平均 = 330ms
+
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2019/02/16/cmcc-ipv6/settings-bridge.jpg b/2019/02/16/cmcc-ipv6/settings-bridge.jpg new file mode 100644 index 00000000..9a2f5d11 Binary files /dev/null and b/2019/02/16/cmcc-ipv6/settings-bridge.jpg differ diff --git a/2019/02/16/cmcc-ipv6/settings-ppp.jpg b/2019/02/16/cmcc-ipv6/settings-ppp.jpg new file mode 100644 index 00000000..7764d574 Binary files /dev/null and b/2019/02/16/cmcc-ipv6/settings-ppp.jpg differ diff --git a/2019/02/16/cmcc-ipv6/status-ipv6.jpg b/2019/02/16/cmcc-ipv6/status-ipv6.jpg new file mode 100644 index 00000000..2ae57f6a Binary files /dev/null and b/2019/02/16/cmcc-ipv6/status-ipv6.jpg differ diff --git a/2019/02/23/lean-management/index.html b/2019/02/23/lean-management/index.html new file mode 100644 index 00000000..54f9c841 --- /dev/null +++ b/2019/02/23/lean-management/index.html @@ -0,0 +1,267 @@ + + + + + + + + + + + + Lean management | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Lean management +

+ +

精益管理

    +
  • 学习精益管理的基本理论实质与构成,深入掌握精益管理思维模式的基本要点,以进行科学的精益管理。
  • +
  • 应用精益管理的方法和工具,学会从价值流图中进行分析,学习如何运用精益管理的工具,判断在何处使用。
  • +
  • 通过标准作业案例讲解和日常可视化管理案例的探讨,理解每日目标责任流程,进而帮助企业构建适合自身发展的精益管理系统,推进企业战略变革,成功实现精益转型。
  • +
+

精益管理的定义

    +
  • 什么是精益管理
  • +
  • 精益管理的构成
      +
    • 思维模式
    • +
    • 管理系统
    • +
    • 方法和工具
    • +
    +
  • +
  • 人们对精益管理的认知
  • +
+

思维模式及其要点

    +
  • 价值 vs 浪费
      +
    • 日常管理中的七种浪费
        +
      1. 库存积压的浪费
      2. +
      3. 过度生产的浪费
      4. +
      5. 搬运的浪费
      6. +
      7. 等待的浪费
      8. +
      9. 动作的浪费
      10. +
      11. 加工的浪费
      12. +
      13. 品质缺陷的浪费
      14. +
      +
    • +
    +
  • +
  • 价值流
      +
    • 价值流的定义
    • +
    • 了解价值流图,节拍时间
    • +
    +
  • +
  • 连续流
      +
    • 连续流的定义
    • +
    • 连续流的组织原则 (最高境界是中间在制品[WIP]只有1件)
    • +
    +
  • +
  • 拉动生产
      +
    • 以质量、效率与效益为导向,通过机制和制度建设,构建精益生产的模式与体系
    • +
    • 推动生产(计划导向,库存积压)与拉动(订单导向,按需生产)生产的区别
    • +
    • 推动生产与拉动生产的优缺点
    • +
    +
  • +
  • 持续改进
      +
    • 什么是完美
    • +
    • 不断提高标准,不断完善
    • +
    +
  • +
+

管理系统

    +
  • 精益管理的基本要素
      +
    • 安全管理
    • +
    • 质量管理
    • +
    • 生产管理
    • +
    • 设备管理
    • +
    • 成本管理
    • +
    • 人事管理
    • +
    • 环境管理
    • +
    +
  • +
  • 标准作业案例
  • +
  • 可视化管理
      +
    • 日常可视化管理场景(5S 与站会)
    • +
    • 可视化管理原则
    • +
    +
  • +
  • 每日目标责任流程
  • +
+

方法和工具

    +
  • 常见的方法举例
  • +
  • 价值流图的应用和分析
  • +
  • 价值工具用在何处
  • +
  • 精益生产工具简介
  • +
  • 精益屋
      +
    • 消除 3M (过载,不均衡,浪费)
    • +
    • PDCA (计划,执行,检查,纠正)
    • +
    +
  • +
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2019/03/02/pagination-query/index.html b/2019/03/02/pagination-query/index.html new file mode 100644 index 00000000..3a485541 --- /dev/null +++ b/2019/03/02/pagination-query/index.html @@ -0,0 +1,208 @@ + + + + + + + + + + + + Pagination query | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Pagination query +

+ +

Pagination query

Paging queries consume lot’s of resources and are not scalable very well, should be avoided.

+

Oracle

1
2
3
4
SELECT ID, JSON FROM (
SELECT ROWNUM RN, ID, JSON FROM MY_BASS ORDER BY ID ASC
) AS T WHERE
RN BETWEEN ((@PageNumber - 1) * @RowspPage + 1) AND (@PageNumber * @RowspPage);
+ +

PostgreSQL and MySQL

+
1
2
SELECT ID, JSON FROM MY_BASS ORDER BY ID
LIMIT @RowspPage OFFSET (@PageNumber - 1) * @RowspPage);
+ +

SQL Server (2012 +)

+
1
2
3
SELECT ID, JSON FROM MY_BASS ORDER BY ID
OFFSET ((@PageNumber - 1) * @RowspPage) ROWS
FETCH NEXT @RowspPage ROWS ONLY;
+ +

DB2 (DB2 9.7.4 +)

+
1
2
SELECT ID, JSON FROM MY_BASS ORDER BY ID
LIMIT @RowspPage OFFSET (@PageNumber - 1) * @RowspPage);
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2019/03/09/mersenne-twister-a-verfy-fast-random-number-generator/index.html b/2019/03/09/mersenne-twister-a-verfy-fast-random-number-generator/index.html new file mode 100644 index 00000000..dbae5f23 --- /dev/null +++ b/2019/03/09/mersenne-twister-a-verfy-fast-random-number-generator/index.html @@ -0,0 +1,201 @@ + + + + + + + + + + + + Mersenne Twister - a verfy fast random number generator | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Mersenne Twister - a verfy fast random number generator +

+ +

Mersenne Twister

Mersenne Twister (mt19937) is a verfy fast random number generator of period 2^19937-1, and basically for Monte-Carlo simulations - it is not cryptographically secure “as is”.

+

What is Mersenne Twister (MT)

Mersenne Twister(MT) is a pseudorandom number generating algorithm developped by Makoto Matsumoto and Takuji Nishimura (alphabetical order) in 1996/1997. An improvement on initialization was given on 2002 Jan.

+

MT has the following merits:

+
    +
  • It is designed with consideration on the flaws of various existing generators.
  • +
  • Far longer period and far higher order of equidistribution than any other implemented generators. (It is proved that the period is 2^19937-1, and 623-dimensional equidistribution property is assured.)
  • +
  • Fast generation. (Although it depends on the system, it is reported that there are no much difference in speed between MT and the standard ANSI-C library function rand().
  • +
+

Boost C++ Libraries

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <boost/random/mersenne_twister.hpp>
#include <boost/random/discrete_distribution.hpp>
#include <boost/format.hpp>

int main()
{
boost::mt19937 rng(5489);
for(int i = 0; i < 10; ++i) {
std::cout << (boost::format("0x%08X") % rng()) << std::endl;
}
std::cout << std::endl;
}

/*
0xD091BB5C
0x22AE9EF6
0xE7E1FAEE
0xD5C31F79
0x2082352C
0xF807B7DF
0xE9D30005
0x3895AFE1
0xA1E24BBA
0x4EE4092B
*/
+ +

Java implementation

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
public class MT19937 {
private final static int UPPER_MASK = 0x80000000;
private final static int LOWER_MASK = 0x7fffffff;
private final static int N = 624;
private final static int M = 397;
private final static int[] MAGIC = {0x0, 0x9908b0df};
private final static int MAGIC_FACTOR1 = 1812433253;
private final static int MAGIC_FACTOR2 = 1664525;
private final static int MAGIC_FACTOR3 = 1566083941;
private final static int MAGIC_MASK1 = 0x9d2c5680;
private final static int MAGIC_MASK2 = 0xefc60000;
private final static int MAGIC_SEED = 0x12BD6AA;

// Internal state
private final transient int[] mt = new int[N];
private transient int mti;

public MT19937() {
this(Double.hashCode(System.currentTimeMillis() * (double) System.nanoTime()));
}

public MT19937(int seed) {
setSeed(seed);
}

public MT19937(int[] seed) {
setSeed(seed);
}

public MT19937(byte[] seed) {
setSeed(pack(seed));
}

/*
byte[] { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 }
->
int[] { 0x04030201, 0x00000605 }
*/
private final static int[] pack(byte[] buf) {
int up = ((buf.length + 3) >>> 2);
int[] ibuf = new int[up];
for (int n = 0; n < up; n++) {
int k, m = (n + 1) << 2;
if (m > buf.length)
m = buf.length;
for (k = buf[--m] & 0xff; (m & 0x3) != 0; k = (k << 8) | buf[--m] & 0xff)
;
ibuf[n] = k;
}
return ibuf;
}

// 1 <= buf.length << 624
public final void setSeed(int[] buf) {
setSeed(MAGIC_SEED);

int length = buf.length;
if (length == 0)
return;

int i = 1, j = 0, k = (N > length ? N : length);
for (; k > 0; k--) {
mt[i] = (mt[i] ^ ((mt[i - 1] ^ (mt[i - 1] >>> 30)) * MAGIC_FACTOR2)) + buf[j] + j;
i++;
j++;
if (i >= N) {
mt[0] = mt[N - 1];
i = 1;
}
if (j >= length)
j = 0;
}
for (k = N - 1; k > 0; k--) {
mt[i] = (mt[i] ^ ((mt[i - 1] ^ (mt[i - 1] >>> 30)) * MAGIC_FACTOR3)) - i;
i++;
if (i >= N) {
mt[0] = mt[N - 1];
i = 1;
}
}
mt[0] |= UPPER_MASK; // MSB is 1; assuring non-zero initial array
}

public final void setSeed(int seed) {
mt[0] = seed;
for (mti = 1; mti < N; mti++) {
mt[mti] = (MAGIC_FACTOR1 * (mt[mti - 1] ^ (mt[mti - 1] >>> 30)) + mti);
}
}

public final int next() {
int y;
if (mti >= N) {
int kk;
for (kk = 0; kk < N - M; kk++) {
y = (mt[kk] & UPPER_MASK) | (mt[kk + 1] & LOWER_MASK);
mt[kk] = mt[kk + M] ^ (y >>> 1) ^ MAGIC[y & 0x1];
}
for (; kk < N - 1; kk++) {
y = (mt[kk] & UPPER_MASK) | (mt[kk + 1] & LOWER_MASK);
mt[kk] = mt[kk + (M - N)] ^ (y >>> 1) ^ MAGIC[y & 0x1];
}
y = (mt[N - 1] & UPPER_MASK) | (mt[0] & LOWER_MASK);
mt[N - 1] = mt[M - 1] ^ (y >>> 1) ^ MAGIC[y & 0x1];

mti = 0;
}

y = mt[mti++];

// Tempering
y ^= (y >>> 11);
y ^= (y << 7) & MAGIC_MASK1;
y ^= (y << 15) & MAGIC_MASK2;
y ^= (y >>> 18);

return y;
}

public final void nextBytes(byte[] bytes) {
int i, value, n = bytes.length & 0x7FFF_FFFC;
for (i = 0; i < n; i += 4) {
value = next();
bytes[i] = (byte) (value >> 24);
bytes[i + 1] = (byte) (value >> 16);
bytes[i + 2] = (byte) (value >> 8);
bytes[i + 3] = (byte) (value);
}

n = bytes.length & 0x03;
if (n > 0) {
value = next();
if (n >= 3) {
bytes[i++] = (byte) (value >> 16);
}
if (n >= 2) {
bytes[i++] = (byte) (value >> 8);
}
if (n >= 1) {
bytes[i++] = (byte) (value >> 8);
}
}
}
}
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git "a/2019/03/16/\350\207\252\346\210\221\347\256\241\347\220\206/index.html" "b/2019/03/16/\350\207\252\346\210\221\347\256\241\347\220\206/index.html" new file mode 100644 index 00000000..4a9ae1b6 --- /dev/null +++ "b/2019/03/16/\350\207\252\346\210\221\347\256\241\347\220\206/index.html" @@ -0,0 +1,202 @@ + + + + + + + + + + + + 自我管理 | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ 自我管理 +

+ +

自我管理

自我管理分为 6 个环节:自我认识-自我控制-自我激励-自我完善-自我提升-自我规划。自我管理简单来说是分为当下与未来两个阶段,当下的自我管理从自我认识开始,逐步递进,自我规划是未来进入更高层次的新的循环开始。

+
    +
  1. 自我认识:认识自己的不足与优势。在古希腊戴尔菲神殿有一句世界著名的箴言“认识你自己”。自我认识直观反应是认识自己的优势与不足,这个没错,我想说的是自我认识的最终阶段就是认知习惯,对自己习惯的解读。好的习惯是不自觉的培养自己的优势,坏的习惯培养自己的不足,所以认识到坏习惯并改进,同时培养好习惯是自我认识的根本所在。

    +
  2. +
  3. 自我控制:就是时间管理,控制自己犯错。在传播行业,入行之时粗心是很多人常犯的一个错误,经常前后数据对不上,媒介排期的公式错误等等。自我控制之所以说是时间管理,就是希望通过约束大块的时间让自己努力学习与改进,进而达到少犯或不犯错的地步。

    +
  4. +
  5. 自我激励:即自我暗示产生行动。不要小看自我暗示的力量,我将其总结为一句话“自我暗示产生信心,信心产生动力,动力产生行动”。不管是在学校、还是在给客户提案之时我们都有过上台发言的经历。那个时候,紧张在所难免。怎么消除紧张?其实就是通过自我暗示达到抚平内心的目的。我是这样做的“我是来给客户提思路的,我们在传媒行业所以我们比客户专业,再说即是有些疑问解答不了会后提供也无妨“。通过这个自我暗示,往往会让内心平静很多,加上提案过程中与客户的互动更能消除紧张感。

    +
  6. +
  7. 自我完善:精神与实际提升。能力的增长是积累获得,通过时间的控制以及实际行动会让自己有一些经验与感悟。实际摸索的经验会很大程度上丰富自己的思想,进而指导自己今后的行动。就如媒介当中,你在某个领域摸索了几年,那你除了基本的媒介知识外,更重要的是会找到一套自己的媒介方法去满足客户的需求。自我完善是一个持续不断的过程,因为我们不断会有新的体验,不断改进。改进是一个挑战忍耐力的事情,特别是以精益求精的态度去要求自己。我对程序化投放的理解就是这样一个过程,没有人专门教我,我能利用的是手上的一些做程序化投放的公司介绍,那怎么深入?通过综合与整理各家之言,同时关注相关公众号以及找同行公司要具体方案,并自己实际执客户的程序化投放,最终整理了一套自己的相对完整的程序化资料。这个过程需要持续坚持才有成效。

    +
  8. +
  9. 自我提升:提升核心竞争力。通过前面几个环节,我们对自己的认识更纯粹,能力更了解。这个阶段要做的是提高核心竞争力,将自己的时间与精力更多的偏向这块。怎么偏向,还是控制时间的时间管理方法, 例如 OKR,日计划表等。

    +
  10. +
  11. 自我规划:让自己更优秀。这个阶段是让自己走入更高层次,经历的环节还是前面5个,需要做的就是坚持自我管理这件事,坚持这个环节并不断改进,让它更适合你。

    +
  12. +
+

以上 6 个环节概况起来就是:习惯 -> 时间管理与改进 -> 产生行动 -> 精神与实际提升 -> 提升核心竞争力 -> 循环。

+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2019/03/23/ipv4-multicast-technology/index.html b/2019/03/23/ipv4-multicast-technology/index.html new file mode 100644 index 00000000..49068c83 --- /dev/null +++ b/2019/03/23/ipv4-multicast-technology/index.html @@ -0,0 +1,204 @@ + + + + + + + + + + + + IPv4 Multicast technology | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ IPv4 Multicast technology +

+ +

IPv4 组播技术

组播地址

    +
  1. 224.0.0.0 到 224.0.0.255 被 IANA 预留,地址 224.0.0.0 保留不做分配,其它地址供路由协议及拓扑查找和维护协议使用。该范围内的地址属于局部范畴,不论 TTL 为多少,都不会被路由器转发。

    +
  2. +
  3. 224.0.1.0 到 238.255.255.255 为用户可用的组播地址,在全网范围内有效。其中 232.0.0.0/8 为 SSM 组地址,而其余则属于 ASM 组地址。

    +
  4. +
  5. 239.0.0.0 到 239.255.255.255 为本地管理组播地址,仅在特定的本地范围内有效,也属于 ASM 组地址。使用本地管理组地址可以灵活定义组播域的范围,以实现不同组播域之间的地址隔离,从而有助于在不同组播域内重复使用相同组播地址而不会引起冲突。

    +
  6. +
+

组播模型

    +
  1. ASM 模型:即任意源组播模型。在 ASM 模型中,任一发送者都可作为组播源向某组播组地址发送组播信息,接收者通过加入由该组播组地址标识的组播组以获得发往该组播组的组播信息。在 ASM 模型中,接收者无法预先知道组播源的位置,但可以在任意时间加入或离开组播组。

    +
  2. +
  3. SSM 模型:即指定信源组播模型。在现实生活中,用户可能只对某些组播源发送的组播信息感兴趣,而不愿接收其它源发送的信息。SSM 模型为用户提供了一种能够在客户端指定组播源的传输服务。

    +
  4. +
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2019/03/30/vxlan-on-bare-metal/index.html b/2019/03/30/vxlan-on-bare-metal/index.html new file mode 100644 index 00000000..b14e35b6 --- /dev/null +++ b/2019/03/30/vxlan-on-bare-metal/index.html @@ -0,0 +1,294 @@ + + + + + + + + + + + + VXLAN on Bare Metal | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ VXLAN on Bare Metal +

+ +

VXLAN on Bare Metal

Host way and sun

127.0.0.1                       localhost
+23.239.7.231                    way.songdongsheng.info          way
+172.104.155.135                 sun.songdongsheng.info          sun
+
+::1                             localhost
+2600:3c01::f03c:91ff:fed5:e79a  way.songdongsheng.info          way
+2a01:7e01::f03c:91ff:fe60:3c56  sun.songdongsheng.info          sun
+
+

Enable IP Forwarding

net.ipv4.ip_forward = 1
+
+

Open UDP/4789 port

Since VXLAN uses UDP packet to forward encapsulated the L2 frames, UDP/4789 port must be opened.

+
iptables -t filter -I INPUT -p udp -m udp --dport 4789 -j ACCEPT
+
+

Increase maximum number of IGMP memberships

# cat /proc/sys/net/ipv4/igmp_max_memberships
+20
+
+echo 256 >/proc/sys/net/ipv4/igmp_max_memberships
+
+

VXLAN and route on way

ip link add vxlan.1 type vxlan id 1 remote 172.104.155.135 dev eth0 dstport 4789
+
+ip link add vxlan.1 type vxlan id 1 dstport 4789
+bridge fdb append 00:00:00:00:00:00 dev vxlan.1 dst 172.104.155.135
+bridge fdb append 00:00:00:00:00:00 dev vxlan.1 dst 23.239.7.231
+
+ip address add 192.168.101.1 dev vxlan.1
+ip link set up vxlan.1 mtu 1450
+route add -net 192.168.0.0/16 gw 192.168.101.1
+
+bridge fdb show dev vxlan.1
+
+

VXLAN and route on sun

ip link add vxlan.1 type vxlan id 1 remote 23.239.7.231 dev eth0 dstport 4789
+
+ip link add vxlan.1 type vxlan id 1 dstport 4789
+bridge fdb append 00:00:00:00:00:00 dev vxlan.1 dst 172.104.155.135
+bridge fdb append 00:00:00:00:00:00 dev vxlan.1 dst 23.239.7.231
+
+ip address add 192.168.102.1 dev vxlan.1
+ip link set up vxlan.1 mtu 1450
+route add -net 192.168.0.0/16 gw 192.168.102.1
+
+bridge fdb show dev vxlan.1
+
+

MTU of VXLAN

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
步骤操作/封包协议长度MTU
1ping -s 1422ICMP1430 = 1422 + 8 (ICMP header)
2L3IP1450 = 1430 + 20 (IP header)VxLAN Interface 的 MTU
3L2Ethernet1464 = 1450 + 14 (Ethernet header)
4VxLANUDP1480 = 1464 + 8 (VxLAN header) + 8 (UDP header)
5L3IP1500 = 1480 + 20 (IP header)物理网卡的(IP)MTU,它不包括 Ethernet header 的长度
6L2Ethernet1514 = 1500 + 14 (Ethernet header)最大可传输帧大小
+

因此,VxLAN 的 overhead 是 1514 - 1464 = 50 byte。

+

VXLAN verify

ethtool vxlan.1
+ethtool -i vxlan.1
+ethtool -k vxlan.1
+
+bridge fdb show vxlan.1
+ip -d link show vxlan.1
+ip monitor neigh dev vxlan.1
+
+ethtool -i docker0
+
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2019/04/05/rbac-principle/index.html b/2019/04/05/rbac-principle/index.html new file mode 100644 index 00000000..32494d4c --- /dev/null +++ b/2019/04/05/rbac-principle/index.html @@ -0,0 +1,225 @@ + + + + + + + + + + + + RBAC principle | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ RBAC principle +

+ +

RBAC principle

RBAC 三角形

RBAC 三角形有 2 种流行的描述,who/what/how 和 who/what/where,没有实质上的不同。都是定义了什么人可以对什么资源做什么操作。

+

RBAC 三角形

+
    +
  1. Where 定义了操作范围 (scope)。
  2. +
  3. What 定义了角色可以做什么操作 (Role)。
  4. +
  5. Who 定义了谁可以执行操作 (Role Group)。
  6. +
+

RBAC 实体

    +
  1. User:有权访问系统的个体

    +
  2. +
  3. Role:组织内的命名作业功能,通常是为了完成某项职责而必须具有的权限集合。

    +
  4. +
  5. Permission:批准访问一个或多个对象的特定模式。

    +
      +
    • Object:所有权限控制对象
    • +
    • Operation:权限控制对象支持的操作。基本对象操作有:
        +
      • A = Append
      • +
      • C = Create
      • +
      • R = Read
      • +
      • U = Update
      • +
      • D = Delete
      • +
      • E = Execute
      • +
      +
    • +
    • ID:权限标识,由对象标识和操作组合而成。
    • +
    +
  6. +
  7. Session:用户与激活的分配给用户的角色的子集的映射。

    +
  8. +
+

image

+

RBAC 授权约束

授权约束分为静态约束(SSD)和动态约束(DSD),用来实现职责分离,基于时间和地点的权限等。

+
    +
  1. 静态约束(SSD),在系统配置时已经确定的约束。例如用户不应该既当裁判员,又当运动员。
  2. +
  3. 动态约束(DSD),在系统运行时才确定的约束。例如只有在工作时间才能登陆,只有在特定地区才能具有特定权限。
  4. +
+

UML responsibility of RBAC

image

+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2019/04/05/rbac-principle/rbac-triangle.jpg b/2019/04/05/rbac-principle/rbac-triangle.jpg new file mode 100644 index 00000000..cc4c5892 Binary files /dev/null and b/2019/04/05/rbac-principle/rbac-triangle.jpg differ diff --git a/2019/04/05/rbac-principle/rbac-uml.jpg b/2019/04/05/rbac-principle/rbac-uml.jpg new file mode 100644 index 00000000..732ffb38 Binary files /dev/null and b/2019/04/05/rbac-principle/rbac-uml.jpg differ diff --git a/2019/04/05/rbac-principle/rbac.jpg b/2019/04/05/rbac-principle/rbac.jpg new file mode 100644 index 00000000..e5892336 Binary files /dev/null and b/2019/04/05/rbac-principle/rbac.jpg differ diff --git a/2019/04/13/diagram-of-uml-and-sysml/SysML.png b/2019/04/13/diagram-of-uml-and-sysml/SysML.png new file mode 100644 index 00000000..92e02012 Binary files /dev/null and b/2019/04/13/diagram-of-uml-and-sysml/SysML.png differ diff --git a/2019/04/13/diagram-of-uml-and-sysml/index.html b/2019/04/13/diagram-of-uml-and-sysml/index.html new file mode 100644 index 00000000..ed4eaeed --- /dev/null +++ b/2019/04/13/diagram-of-uml-and-sysml/index.html @@ -0,0 +1,188 @@ + + + + + + + + + + + + Diagram of UML and SysML | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Diagram of UML and SysML +

+ +

Diagram of UML and SysML

UML Diagram

image

+

SysML Diagram

SysML Diagram

+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2019/04/13/diagram-of-uml-and-sysml/uml-25-diagrams.png b/2019/04/13/diagram-of-uml-and-sysml/uml-25-diagrams.png new file mode 100644 index 00000000..cc489379 Binary files /dev/null and b/2019/04/13/diagram-of-uml-and-sysml/uml-25-diagrams.png differ diff --git a/2019/04/19/undertow-web-server/index.html b/2019/04/19/undertow-web-server/index.html new file mode 100644 index 00000000..cdf61bdd --- /dev/null +++ b/2019/04/19/undertow-web-server/index.html @@ -0,0 +1,225 @@ + + + + + + + + + + + + Undertow web server | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Undertow web server +

+ +

Undertow

Undertow is a flexible performant web server written in java, providing both blocking and non-blocking API’s based on NIO.

+

Undertow has a composition based architecture that allows you to build a web server by combining small single purpose handlers. The gives you the flexibility to choose between a full Java EE servlet 4.0 container, or a low level non-blocking handler, to anything in between.

+

Undertow is designed to be fully embeddable, with easy to use fluent builder APIs. Undertow’s lifecycle is completely controlled by the embedding application.

+

Why Undertow

    +
  • HTTP/2 Support
      +
    • Undertow supports HTTP/2 out of the box, no overriding the boot class path required.
    • +
    +
  • +
  • HTTP Upgrade Support
      +
    • Support for HTTP upgrade, to allow multiple protocols to be multiplexed over the HTTP port.
    • +
    +
  • +
  • Web Socket Support
      +
    • Undertow provides full support for Web Sockets, including JSR-356 support.
    • +
    +
  • +
  • Servlet 4.0
      +
    • Undertow provides support for Servlet 4.0, including support for embedded servlet. It is also possible to mix both Servlets and native undertow non-blocking handlers in the same deployment.
    • +
    +
  • +
  • Embeddable
      +
    • Undertow can be embedded in an application or run standalone with just a few lines of code.
    • +
    +
  • +
  • Flexible
      +
    • An Undertow server is configured by chaining handlers together. It is possible to add as much or as little functionality as you need, so you don’t pay for what you are not using.
    • +
    +
  • +
  • Lightweight
      +
    • Undertow is extremely lightweight, with the Undertow core jar coming in at under 1Mb. It is lightweight at runtime too, with a simple embedded server using less than 4Mb of heap space.
    • +
    +
  • +
+

Show me the code

Here is a simple Hello World server using Async IO:

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
public class HelloWorldServer {
public static void main(final String[] args) {
Undertow server = Undertow.builder()
.addHttpListener(8080, "localhost")
.setHandler(new HttpHandler() {
@Override
public void handleRequest(final HttpServerExchange exchange) throws Exception {
exchange.getResponseHeaders().put(Headers.CONTENT_TYPE, "text/plain");
exchange.getResponseSender().send("Hello World");
}
}).build();
server.start();
}
}
+ +

Maven

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<dependency>
<groupId>io.undertow</groupId>
<artifactId>undertow-core</artifactId>
<version>2.0.20.Final</version>
</dependency>

<dependency>
<groupId>io.undertow</groupId>
<artifactId>undertow-servlet</artifactId>
<version>2.0.20.Final</version>
</dependency>

<dependency>
<groupId>io.undertow</groupId>
<artifactId>undertow-websockets-jsr</artifactId>
<version>2.0.20.Final</version>
</dependency>
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2019/04/26/tcc-principle/index.html b/2019/04/26/tcc-principle/index.html new file mode 100644 index 00000000..75a81014 --- /dev/null +++ b/2019/04/26/tcc-principle/index.html @@ -0,0 +1,234 @@ + + + + + + + + + + + + TCC principle | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ TCC principle +

+ +

TCC principle

In a nutshell

    +
  1. Try: 尝试执行业务

    +
      +
    • 完成所有业务检查(一致性)
    • +
    • 预留必须业务资源(准隔离性)
    • +
    • Autonomous Timeout and Cancel
    • +
    +
  2. +
  3. Confirm: 确认执行业务

    +
      +
    • 真正执行业务
    • +
    • 不作任何业务检查
    • +
    • 只使用 Try 阶段预留的业务资源
    • +
    • 操作满足幂等性
    • +
    +
  4. +
  5. Cancel: 取消执行业务

    +
      +
    • 释放 Try 阶段预留的业务资源
    • +
    • 操作满足幂等性
    • +
    +
  6. +
+
1
2
3
4
5
public interface TccService<P extends TccRequest<R>, R extends Serializable> {
R doTry(P param);
void doConfirm(P param);
void doCancel(P param);
}
+ +

Participant

    +
  1. Try: ParticipantLink

    +
    1
    2
    3
    4
    5
    6
    7
    {
    "participantLink":
    {
    "uri":"http://www.example.com/v1/tcc/tx/782973177474060290",
    "expires":"2017-10-24T10:20:12Z"
    }
    }
    +
  2. +
  3. Confirm

    +
    1
    2
    3
    4
    5
    6
    PUT /v1/tcc/tx/782973177474060290 HTTP/1.1
    Host: www.example.com
    Accept: application/tcc

    HTTP/1.1 204 No Content
    HTTP/1.1 404 Not Found
    +
  4. +
  5. Cancel

    +
    1
    2
    3
    4
    5
    DELETE /v1/tcc/tx/782973177474060290 HTTP/1.1
    Host: www.example.com
    Accept: application/tcc

    HTTP/1.1 204 No Content
    +
  6. +
  7. URL

    +
    1
    2
    3
    ^/v1/tcc/bo/{type}       POST
    ^/v1/tcc/bo/{type}/{id} PATCH|PUT|DELETE
    ^/v1/tcc/tx/{txid} PUT to confirm, DELETE to cancel
  8. +
+

Coordinator

    +
  1. Confirm all participants when asked to do so.

    +
  2. +
  3. Recover after failures during the confirmation phase.

    +
  4. +
  5. Allow cancellation of all participants when asked to do so.

    +
  6. +
  7. URL

    +
    1
    2
    ^/v1/tcc/dtc/confirm     PUT to confirm
    ^/v1/tcc/dtc/cancel DELETE to cancel
  8. +
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2019/05/04/mysql-aggregate-function-group-concat/index.html b/2019/05/04/mysql-aggregate-function-group-concat/index.html new file mode 100644 index 00000000..ac08f0b9 --- /dev/null +++ b/2019/05/04/mysql-aggregate-function-group-concat/index.html @@ -0,0 +1,198 @@ + + + + + + + + + + + + MySQL Aggregate Function GROUP_CONCAT() | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ MySQL Aggregate Function GROUP_CONCAT() +

+ +

Group concat

The MySQL GROUP_CONCAT() function is an aggregate function that concatenates strings from a group into a single string with various options.

+

MySQL

1
2
3
4
5
6
7
8
select parent_name, group_concat(child_name)
from children
group by parent_name;

select parent_name,
group_concat(child_name order by child_name asc separator ';')
from children
group by parent_name;
+ +

PostgreSQL

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
select parent_name,
array_to_string(array_agg(child_name), ',')
from children
group by parent_name;

select parent_name,
array_to_string(array_agg(child_name order by child_name ASC), ',')
from children
group by parent_name;

SELECT a.farm_id,
string_agg(DISTINCT a.name, ',') as animals,
string_agg(DISTINCT t.name, ',') as tools
FROM
animal a, tool t
WHERE a.farm_id = t.farm_id
GROUP BY a.farm_id;

FARM_ID ANIMALS TOOLS
1 cow,horse axe,hammer,spade
+ +

Oracle

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
SELECT parent_name,
LISTAGG(child_name, ',') WITHIN GROUP (ORDER BY child_name)
FROM children
GROUP BY parent_name;

CREATE OR REPLACE
FUNCTION get_comma_separated_value (input_val in number)
RETURN VARCHAR2
IS
return_text VARCHAR2(10000) := NULL;
BEGIN
FOR x IN (SELECT col2 FROM table_name WHERE col1 = input_val) LOOP
return_text := return_text || ',' || x.col2 ;
END LOOP;
RETURN LTRIM(return_text, ',');
END;

select parent_name, get_comma_separated_value(child_name)
from children;
+ +

SQLite

1
2
3
4
5
6
7
8
9
10
select parent_name, group_concat(child_name)
from children group by parent_name;

select parent_name, group_concat(child_name, ';')
from children group by parent_name;

select parent_name, group_concat(child_name)
from
(select parent_name, child_name from children order by child_name)
group by parent_name;
+ +

HSQLDB

1
2
3
4
5
6
7
8
select parent_name, group_concat(child_name)
from children
group by parent_name;

select parent_name,
group_concat(child_name order by child_name SEPARATOR ';')
from children
group by parent_name;
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2019/05/11/sorted-base64-algorithm/index.html b/2019/05/11/sorted-base64-algorithm/index.html new file mode 100644 index 00000000..bef7f3f9 --- /dev/null +++ b/2019/05/11/sorted-base64-algorithm/index.html @@ -0,0 +1,190 @@ + + + + + + + + + + + + Sorted base64 algorithm | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Sorted base64 algorithm +

+ +

Sorted Base64

The standard base64 algorithm does not preserve the order of the original data, so we need sorted base64 algorithm.

+

URL safe characters include uppercase and lowercase letters, decimal digits, hyphen, period, underscore, and tilde, i.e. ALPHA / DIGIT / “-“ / “.” / “_” / “~”.

+

Sorted Base64 encoding scheme use ‘-‘, decimal digits, uppercase letters, ‘_’, lowercase letters, in the ASCII table order.

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
import java.nio.charset.StandardCharsets;
import java.util.Arrays;

/**
* Sorted Base64 without padding bytes.
* <p>
* URL safe characters include uppercase and lowercase letters, decimal digits,
* hyphen, period, underscore, and tilde, i.e. ALPHA / DIGIT / "-" / "." / "_" / "~".
* <p>
* Sorted Base64 encoding scheme use '-', decimal digits, uppercase letters, '_',
* lowercase letters, in the ASCII table order.
*/
public class SortedBase64 {

private SortedBase64() {
}

/**
* Returns a {@link Encoder} that encodes using the
* Sorted base64 encoding scheme.
*
* @return A Sorted Base64 encoder.
*/
public static Encoder getEncoder() {
return new Encoder();
}

/**
* Returns a {@link Decoder} that decodes using the
* Sorted base64 encoding scheme.
*
* @return A Sorted Base64 decoder.
*/
public static Decoder getDecoder() {
return new Decoder();
}

/**
* This class implements an encoder for encoding byte data using
* the Sorted Base64 {@link SortedBase64} encoding scheme.
* <p>
* <p> Instances of {@link Encoder} class are safe for use by
* multiple concurrent threads.
*/
public static class Encoder {

private Encoder() {
}

/**
* This array is a lookup table that translates 6-bit positive integer
* index values into their "Sorted Base64 Alphabet".
*/
private static final char[] toSortedBase64 = {
'-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
'_', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'
};

private static int outLength(int srcLen) {
return (srcLen * 8 + 5) / 6;
}

/**
* Encodes the specified byte array into a String using the {@link SortedBase64}
* encoding scheme.
*/
public String encode(byte[] src) {
byte[] encoded = new byte[outLength(src.length)];
encode(src, 0, encoded, 0, src.length);
return new String(encoded, 0, encoded.length, StandardCharsets.ISO_8859_1);
}

/**
* Encodes an array from the specified source array, beginning at the
* specified position, to the specified position of the destination array,
* using the {@link SortedBase64} encoding scheme. The number of bytes
* encoded is equal to the <code>length</code> argument. The returned
* value is of the length of the resulting bytes.
*/
public int encode(byte[] src, int srcPos, byte[] dst, int dstPos, int length) {
if (srcPos + length > src.length || outLength(length) + dstPos > dst.length) {
throw new IllegalArgumentException("Output byte array is too small for encoding all input bytes");
}

int sp = srcPos;
int s1 = srcPos + (length / 3) * 3;
int dp = dstPos;
while (sp < s1) {
int bits = (src[sp++] & 0xff) << 16 | (src[sp++] & 0xff) << 8 | (src[sp++] & 0xff);

dst[dp++] = (byte) toSortedBase64[(bits >>> 18) & 0x3f];
dst[dp++] = (byte) toSortedBase64[(bits >>> 12) & 0x3f];
dst[dp++] = (byte) toSortedBase64[(bits >>> 6) & 0x3f];
dst[dp++] = (byte) toSortedBase64[bits & 0x3f];
}

int s2 = srcPos + length;
if (s1 < s2) {
// 1 or 2 leftover bytes
int b0 = src[sp++] & 0xff;
dst[dp++] = (byte) toSortedBase64[b0 >> 2];
if (sp == s2) {
dst[dp++] = (byte) toSortedBase64[(b0 << 4) & 0x3f];
} else {
int b1 = src[sp] & 0xff;
dst[dp++] = (byte) toSortedBase64[(b0 << 4) & 0x3f | (b1 >> 4)];
dst[dp++] = (byte) toSortedBase64[(b1 << 2) & 0x3f];
}
}

return dp - dstPos;
}
}

/**
* This class implements a decoder for decoding byte data using the
* Sorted Base64 {@link SortedBase64} encoding scheme.
*
* <p> Instances of {@link Decoder} class are safe for use by
* multiple concurrent threads.
*/
public static class Decoder {

private Decoder() {
}

/**
* Lookup table for decoding unicode characters drawn from the
* "Sorted Base64 Alphabet" into their 6-bit positive integer
* equivalents. Characters that are not in the Sorted Base64
* alphabet but fall within the bounds of the array are encoded to -1.
*/
private static final int[] fromSortedBase64 = new int[128];

static {
Arrays.fill(fromSortedBase64, -1);
for (int i = 0; i < SortedBase64.Encoder.toSortedBase64.length; i++)
fromSortedBase64[SortedBase64.Encoder.toSortedBase64[i]] = i;
}

private static int outLength(int srcLen) {
return (srcLen * 6) / 8;
}

/**
* Decodes a Base64 encoded String into a newly-allocated byte array
* using the {@link SortedBase64} encoding scheme.
*/
public byte[] decode(String b64) {
byte[] src = b64.getBytes(StandardCharsets.ISO_8859_1);
byte[] dst = new byte[outLength(src.length)];
int ret = decode(src, 0, dst, 0, src.length);
if (ret != dst.length) {
dst = Arrays.copyOf(dst, ret);
}
return dst;
}

/**
* Decodes an array from the specified source array, beginning at the
* specified position, to the specified position of the destination array,
* using the {@link SortedBase64} encoding scheme. The number of bytes
* decoded is equal to the <code>length</code> argument. The returned
* value is of the length of the resulting bytes.
*/
public int decode(byte[] src, int srcPos, byte[] dst, int dstPos, int length) {
if (length < 2 || length % 4 == 1) {
throw new IllegalArgumentException("Input byte array has invalid length for decoding");
}

if (srcPos + length > src.length || outLength(length) + dstPos > dst.length) {
throw new IllegalArgumentException("Output byte array is too small for decoding all input bytes");
}

int sp = srcPos;
int s1 = srcPos + (length / 4) * 4;
int dp = dstPos;
while (sp < s1) {
int bits = (fromSortedBase64[src[sp++]] & 0x3f) << 18 | (fromSortedBase64[src[sp++]] & 0x3f) << 12
| (fromSortedBase64[src[sp++]] & 0x3f) << 6 | (fromSortedBase64[src[sp++]] & 0x3f);

dst[dp++] = (byte) (bits >> 16);
dst[dp++] = (byte) (bits >> 8);
dst[dp++] = (byte) (bits);
}

int s2 = srcPos + length;
if (s1 < s2) {
// 2 or 3 leftover bytes
int b0 = (fromSortedBase64[src[sp++]] & 0x3f) << 6 | (fromSortedBase64[src[sp++]] & 0x3f);
if (sp == s2) {
dst[dp++] = (byte) (b0 >> 4);
} else {
int b1 = (b0 << 4) | ((fromSortedBase64[src[sp]] & 0x3f) >> 2);
dst[dp++] = (byte) (b1 >> 8);
dst[dp++] = (byte) (b1);
}
}

return dp - dstPos;
}
}
}

+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2019/05/18/ulid-and-tsid/index.html b/2019/05/18/ulid-and-tsid/index.html new file mode 100644 index 00000000..04d71da0 --- /dev/null +++ b/2019/05/18/ulid-and-tsid/index.html @@ -0,0 +1,211 @@ + + + + + + + + + + + + ULID and TSID | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ ULID and TSID +

+ +

ULID and TSID

ULID

UUID can be suboptimal for many uses-cases because:

+
    +
  • It isn’t the most character efficient way of encoding 128 bits of randomness
  • +
  • UUID v1/v2 is impractical in many environments, as it requires access to a unique, stable MAC address
  • +
  • UUID v3/v5 requires a unique seed and produces randomly distributed IDs, which can cause fragmentation in many data structures
  • +
  • UUID v4 provides no other information than randomness which can cause fragmentation in many data structures
  • +
+

Instead, herein is proposed ULID:

+
    +
  • 128-bit compatibility with UUID
  • +
  • 1.21e+24 unique ULIDs per millisecond (48 bit ms + 80 bit randomness)
  • +
  • Lexicographically sortable!
  • +
  • Canonically encoded as a 26 character string, as opposed to the 36 character UUID
  • +
  • Uses Crockford’s base32 for better efficiency and readability (5 bits per character)
  • +
  • Case insensitive
  • +
  • No special characters (URL safe)
  • +
  • Monotonic sort order (correctly detects and handles the same millisecond in the same generator instance)
  • +
+

TSID

TSID is a general-purpose trend sorted identifier generator, it is the variant version of ULID, since ULID is often overkill. TSID don’t strict guaranty sort order in the same millisecond or microsecond.

+
    +
  • 48 bit ms + 32 bit randomness = VARCHAR(16), 8919 year
  • +
  • 58 bit us + 42 bit randomness = VARCHAR(20), 9133 year
  • +
  • 58 bit us + 62 bit randomness = VARCHAR(24), 9133 year
  • +
  • 48 bit ms + 80 bit randomness = VARCHAR(26), 8919 year
  • +
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2019/05/25/remove-blank-element-from-json/index.html b/2019/05/25/remove-blank-element-from-json/index.html new file mode 100644 index 00000000..e4e98b6c --- /dev/null +++ b/2019/05/25/remove-blank-element-from-json/index.html @@ -0,0 +1,187 @@ + + + + + + + + + + + + Remove blank element from json | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Remove blank element from json +

+ +

Remove blank element from json

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
$ cat ~/.jq

def remove_empty:
. | walk(
if type == "object" then
with_entries(
select(
.value != null and
.value != "" and
.value != [] and
.value != {}
)
)
else .
end
);
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2019/06/01/windows-10-kit/index.html b/2019/06/01/windows-10-kit/index.html new file mode 100644 index 00000000..cb5f714d --- /dev/null +++ b/2019/06/01/windows-10-kit/index.html @@ -0,0 +1,212 @@ + + + + + + + + + + + + Windows 10 Kit | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Windows 10 Kit +

+ +

Windows 10 Kit

What’s new in Windows 10

+

Windows 10 provides IT professionals with advanced protection against modern security threats and comprehensive management and control over devices and apps, as well as flexible deployment, update, and support options. Learn about new features in Windows 10 for IT professionals, such as Windows Information Protection, Windows Hello, Device Guard, and more.

+

Windows 10 SDK

+

The Windows 10 SDK (10.0.18362.0) for Windows 10, version 1903 provides the latest headers, libraries, metadata, and tools for building Windows 10 apps.

+

Windows 10 WDK

+

The Windows Driver Kit (WDK) for Windows 10, version 1903 is used to develop, test, and deploy Windows drivers. The latest public version of WDK is available below.

+

Windows 10 ADK

+

The Windows Assessment and Deployment Kit (Windows ADK) for Windows 10, version 1903 has the tools you need to customize Windows images for large-scale deployment, and to test the quality and performance of your system, its added components, and the applications running on it.

+

Windows Hardware Lab Kit

+

The Windows Hardware Lab Kit (Windows HLK) is a test framework used to test hardware devices for Windows 10 and all versions of Windows Server starting with Windows Server 2016. To qualify for the Windows Hardware Compatibility Program, your product must pass certain tests using the Windows HLK.

+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2019/06/08/the-schema-of-azure-event-grid/index.html b/2019/06/08/the-schema-of-azure-event-grid/index.html new file mode 100644 index 00000000..43f86e19 --- /dev/null +++ b/2019/06/08/the-schema-of-azure-event-grid/index.html @@ -0,0 +1,197 @@ + + + + + + + + + + + + The Schema of Azure Event Grid | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ The Schema of Azure Event Grid +

+ +

The Schema of Azure Event Grid

+

Schemas

Event Schema

1
2
3
4
5
6
7
8
9
10
11
12
13
14
[
{
"topic": string,
"subject": string,
"id": string,
"eventType": string,
"eventTime": string,
"data":{
object-unique-to-each-publisher
},
"dataVersion": string,
"metadataVersion": string
}
]
+ +

subscription schema

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{
"properties": {
"destination": {
"endpointType": "webhook",
"properties": {
"endpointUrl": "https://example.azurewebsites.net/api/HttpTriggerCSharp1?code=VXbGWce53l48Mt8wuotr0GPmyJ/nDT4hgdFj9DpBiRt38qqnnm5OFg=="
}
},
"filter": {
"includedEventTypes": [ "blobCreated", "blobDeleted" ],
"subjectBeginsWith": "blobServices/default/containers/mycontainer/log",
"subjectEndsWith": ".jpg",
"subjectIsCaseSensitive": "true"
}
}
}
+ +

Events

Azure Blob storage event

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
[
{
"topic": "/subscriptions/{subscription-id}/resourceGroups/Storage/providers/Microsoft.Storage/storageAccounts/xstoretestaccount",
"subject": "/blobServices/default/containers/oc2d2817345i200097container/blobs/oc2d2817345i20002296blob",
"eventType": "Microsoft.Storage.BlobCreated",
"eventTime": "2017-06-26T18:41:00.9584103Z",
"id": "831e1650-001e-001b-66ab-eeb76e069631",
"data": {
"api": "PutBlockList",
"clientRequestId": "6d79dbfb-0e37-4fc4-981f-442c9ca65760",
"requestId": "831e1650-001e-001b-66ab-eeb76e000000",
"eTag": "0x8D4BCC2E4835CD0",
"contentType": "application/octet-stream",
"contentLength": 524288,
"blobType": "BlockBlob",
"url": "https://oc2d2817345i60006.blob.core.windows.net/oc2d2817345i200097container/oc2d2817345i20002296blob",
"sequencer": "00000000000004420000000000028963",
"storageDiagnostics": {
"batchId": "b68529f3-68cd-4744-baa4-3c0498ec19f0"
}
},
"dataVersion": "",
"metadataVersion": "1"
}
]
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2019/06/15/drop-linux-cache/index.html b/2019/06/15/drop-linux-cache/index.html new file mode 100644 index 00000000..7587d96d --- /dev/null +++ b/2019/06/15/drop-linux-cache/index.html @@ -0,0 +1,187 @@ + + + + + + + + + + + + Drop Linux Cache | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Drop Linux Cache +

+ +

Drop Linux Cache

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/bash

/bin/sync

# Free pagecache
# echo 1 > /proc/sys/vm/drop_caches
# sysctl vm.drop_caches=1

# Free reclaimable slab objects (includes dentries and inodes)
# echo 2 > /proc/sys/vm/drop_caches
# sysctl vm.drop_caches=2

# Free both page cache and slab objects
echo 3 > /proc/sys/vm/drop_caches
sysctl vm.drop_caches=3

# Disable drop cache logs, you will not be able to enable the logs again unless the system is restarted.
# https://github.com/torvalds/linux/blob/master/fs/drop_caches.c
# stfu |= sysctl_drop_caches & 4;

# echo 4 > /proc/sys/vm/drop_caches
# sysctl vm.drop_caches=4

/bin/sync
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2019/06/23/portable-hardware-locality/2XeonSPv2+2kmem.v2.1.png b/2019/06/23/portable-hardware-locality/2XeonSPv2+2kmem.v2.1.png new file mode 100644 index 00000000..135b0745 Binary files /dev/null and b/2019/06/23/portable-hardware-locality/2XeonSPv2+2kmem.v2.1.png differ diff --git a/2019/06/23/portable-hardware-locality/2XeonSPv2+dax+pmem.v2.1.png b/2019/06/23/portable-hardware-locality/2XeonSPv2+dax+pmem.v2.1.png new file mode 100644 index 00000000..81decd41 Binary files /dev/null and b/2019/06/23/portable-hardware-locality/2XeonSPv2+dax+pmem.v2.1.png differ diff --git a/2019/06/23/portable-hardware-locality/2XeonSPv2+msc.v2.1.png b/2019/06/23/portable-hardware-locality/2XeonSPv2+msc.v2.1.png new file mode 100644 index 00000000..0338ec36 Binary files /dev/null and b/2019/06/23/portable-hardware-locality/2XeonSPv2+msc.v2.1.png differ diff --git a/2019/06/23/portable-hardware-locality/index.html b/2019/06/23/portable-hardware-locality/index.html new file mode 100644 index 00000000..d5a37012 --- /dev/null +++ b/2019/06/23/portable-hardware-locality/index.html @@ -0,0 +1,201 @@ + + + + + + + + + + + + Portable Hardware Locality | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Portable Hardware Locality +

+ +

Portable Hardware Locality

+

In a nutshell

The Portable Hardware Locality (hwloc) software package provides a portable abstraction (across OS, versions, architectures, …) of the hierarchical topology of modern architectures, including NUMA memory nodes, sockets, shared caches, cores and simultaneous multithreading. It also gathers various system attributes such as cache and memory information as well as the locality of I/O devices such as network interfaces, InfiniBand HCAs or GPUs.

+

hwloc primarily aims at helping applications with gathering information about increasingly complex parallel computing platforms so as to exploit them accordingly and efficiently. For instance, two tasks that tightly cooperate should probably be placed onto cores sharing a cache. However, two independent memory-intensive tasks should better be spread out onto different sockets so as to maximize their memory throughput. As described in this paper, OpenMP threads have to be placed according to their affinities and to the hardware characteristics. MPI implementations apply similar techniques while also adapting their communication strategies to the network locality as described in this paper or this one.

+

hwloc may also help many applications just by providing a portable CPU and memory binding API and a reliable way to find out how many cores and/or hardware threads are available.

+

Examples of outputs

61 GB, 8 Cores

image

+

383 GB, 32 Cores

image

+

375 GB, 40 Cores

image

+

1487 GB, 40 Cores

image

+

1861 GB, 40 Cores

image

+

The hierarchical topology map of the current system

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# hwloc-ls
Machine (16GB)
Package L#0 + L3 L#0 (30MB) + L2 L#0 (256KB) + L1d L#0 (32KB) + L1i L#0 (32KB)
Core L#0 + PU L#0 (P#0)
Core L#1 + PU L#1 (P#1)
Misc(MemoryModule)
HostBridge L#0
PCI 8086:7010
Block(Removable Media Device) L#0 "sr0"
PCI 1013:00b8
GPU L#1 "card0"
GPU L#2 "controlD64"
PCI 1af4:1000
PCI 1af4:1001
+ +

The information about the given objects

1
2
3
4
5
6
7
8
9
10
11
12
# hwloc-info
depth 0: 1 Machine (type #1)
depth 1: 1 Package (type #3)
depth 2: 1 L3Cache (type #4)
depth 3: 1 L2Cache (type #4)
depth 4: 1 L1dCache (type #4)
depth 5: 1 L1iCache (type #4)
depth 6: 2 Core (type #5)
depth 7: 2 PU (type #6)
Special depth -3: 1 Bridge (type #9)
Special depth -4: 4 PCI Device (type #10)
Special depth -5: 3 OS Device (type #11)
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2019/06/23/portable-hardware-locality/lstopo.png b/2019/06/23/portable-hardware-locality/lstopo.png new file mode 100644 index 00000000..780aa17e Binary files /dev/null and b/2019/06/23/portable-hardware-locality/lstopo.png differ diff --git a/2019/06/23/portable-hardware-locality/ppc64-full-with-smt.png b/2019/06/23/portable-hardware-locality/ppc64-full-with-smt.png new file mode 100644 index 00000000..35da6b17 Binary files /dev/null and b/2019/06/23/portable-hardware-locality/ppc64-full-with-smt.png differ diff --git a/2019/06/29/block-chain/1ddacfe6-f2cb-3b9f-bfb9-be281f32f7fa.png b/2019/06/29/block-chain/1ddacfe6-f2cb-3b9f-bfb9-be281f32f7fa.png new file mode 100644 index 00000000..3f4587b4 Binary files /dev/null and b/2019/06/29/block-chain/1ddacfe6-f2cb-3b9f-bfb9-be281f32f7fa.png differ diff --git a/2019/06/29/block-chain/3b511bd2-30d9-36b3-b57a-0aaf2f870e64.png b/2019/06/29/block-chain/3b511bd2-30d9-36b3-b57a-0aaf2f870e64.png new file mode 100644 index 00000000..a29baf3d Binary files /dev/null and b/2019/06/29/block-chain/3b511bd2-30d9-36b3-b57a-0aaf2f870e64.png differ diff --git a/2019/06/29/block-chain/ce8cb631-ef24-3f40-b80e-945e32c5fc6d.png b/2019/06/29/block-chain/ce8cb631-ef24-3f40-b80e-945e32c5fc6d.png new file mode 100644 index 00000000..8f2cca7b Binary files /dev/null and b/2019/06/29/block-chain/ce8cb631-ef24-3f40-b80e-945e32c5fc6d.png differ diff --git a/2019/06/29/block-chain/index.html b/2019/06/29/block-chain/index.html new file mode 100644 index 00000000..4983dc64 --- /dev/null +++ b/2019/06/29/block-chain/index.html @@ -0,0 +1,277 @@ + + + + + + + + + + + + Block Chain | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Block Chain +

+ +

区块链

概论

    +
  1. 公有链

    +

    公有链是指对所有人开放,任何人都可以参与的区块链。

    +
  2. +
  3. 联盟链

    +

    联盟链是被多个组织构成的联盟控制,进入和退出需要授权的区块链。

    +
  4. +
  5. 私有链

    +

    私有链是完全被单独的个人或某个组织控制的区块链。

    +
  6. +
+

大部分企业应用场景都不适合公有链,未来企业应用的重点是联盟链。现阶段关注的重点是公有链,公有链是区块链技术的试验田,它会遇到各种复杂的情况和问题,是对新技术和新业务的测试,这能为企业应用提供很好的借鉴。

+

蒙代尔不可能三角关系

对于区块链的去中心化、安全、高效这三个特性,符合蒙代尔不可能三角关系,即不可能同时满足三个条件。公有链实现了完全的去中心化和安全,因此在性能上就很低;联盟链为了企业应用,提高了性能和安全,就不得不在去中心化上进行妥协,通过一个中心化的授权方式来管理节点,实现了半中心化。

+

区块链 2.0 的优势

区块链 1.0 被称之为“全球账簿”。相应的,区块链 2.0 可以被看作一台“全球计算机”:实现了区块链系统的图灵完备,可以在区块链上传和执行应用程序,并且程序的有效执行能得到保证,在此基础上实现了智能合约的功能。相对于区块链 1.0,区块链 2.0 有如下优势:

+
    +
  1. 支持智能合约

    +

    区块链 2.0 定位于应用平台,在这个平台上,可以发布各种智能合约,并能与其它外部IT系统进行数据交互和处理,从而实现各种行业应用。

    +
  2. +
  3. 适应大部分应用场景的交易速度

    +

    通过采用 PBFT、POS、DPOS 等新的共识算法,区块链2.0的交易速度有了很大的提高,峰值速度已经超过 了 3000 TPS(每秒处理交易数量),远远高于比特币的 5 TPS,已经能够满足大部分的金融应用场景。

    +
  4. +
  5. 支持信息加密

    +

    区块链 2.0 因为支持完整的程序运行,可以通过智能合约对发送和接收的信息进行自定义加密和解密,从而达到保护企业和用户隐私的目的,同时零知识证明等先进密码学技术的应用进一步推动了其隐私性的发展。

    +
  6. +
  7. 无资源消耗

    +

    为了维护网络共识,比特币使用的算力超 122029 TH/s,相当于 5000 台天河 2 号 A 运算速度,每天耗电超过 2000 MWh,约合几十万人民币(估测数据)。区块链 2.0 采 用PBFT、DPOS、POS 等新的共识算法,不再需要通过消耗算力达成共识,从而实现对资源的零消耗,使其能绿色安全的部署于企业信息中心。

    +
  8. +
+

区块链 2.0 技术架构

区块链 2.0 采用五层架构,从下到上分别是数据层、网络层、共识层、激励层、智能合约层:

+

image

+
    +
  1. 数据层

    +

    数据层最底层的技术,是一切的基础,主要实现了两个功能,一个是相关数据的存储,另一个是账户和交易的实现与安全。数据存储主要基于Merkle树,通过区块的方式和链式结构实现,大多以 KV 数据库的方式实现持久化,比如以太坊采用 leveldb。帐号和交易的实现基于数字签名、哈希函数和非对称加密技术等多种密码学算法和技术,保证了交易在去中心化的情况下能够安全的进行。

    +
  2. +
  3. 网络层

    +

    网络层主要实现网络节点的连接和通讯,又称点对点技术,是没有中心服务器、依靠用户群交换信息的互联网体系。与有中心服务器的中央网络系统不同,对等网络的每个用户端既是一个节点,也有服务器的功能,其具有去中心化与健壮性等特点。

    +
  4. +
  5. 共识层

    +

    共识层主要实现全网所有节点对交易和数据达成一致,防范拜占庭攻击、女巫攻击、51% 攻击等共识攻击,其算法称为共识机制,因为其应用场景不同,区块链 2.0 出现了多种富有特色的共识机制。

    +
      +
    1. PoS:Proof of Stake,权益证明

      +

      原理:节点获得区块奖励的概率与该节点持有的代币数量和时间成正比,在获取区块奖励后,该节点的代币持有时间清零,重新计算。但由于代币在初期分配时人为因素过高,容易导致后期贫富差距过大。

      +
    2. +
    3. DPoS:Delegate Proof of Stake,股份授权证明

      +

      原理:所有的节点投票选出 100 个(或其他数量)委托节点,区块完全由这 100 个委托节点按照一定算法生成,类似于美国的议会制。

      +
    4. +
    5. Casper:投注共识

      +

      原理:以太坊下一代的共识机制,每个参与共识的节点都要支付一定的押金,节点获取奖励的概率和押金成正比,如果有节点作恶押金则要被扣掉。

      +
    6. +
    7. PBFT:Practical Byzantine Fault Tolerance,拜占庭容错算法

      +

      原理:与一般公有链的共识机制主要基于经济博弈原理不同,PBFT 基于异步网络环境下的状态机副本复制协议,本质上是由数学算法实现了共识,因此区块的确认不需要像公有链一样在若干区块之后才安全,可以实现出块即确认。

      +
    8. +
    9. PoET:Proof of Elapsed Time,消逝时间量证明

      +

      原理:该共识机制由 intel 提出,核心是用 Intel 支持 SGX 技术的 CPU 硬件,在受控安全环境(TEE)下随机产生一些延时,同时 CPU 从硬件级别证明延时的可信性,类似于彩票算法,谁的延时最低,谁将获取记账权。这样,增加记账权的唯一方法就是多增加 CPU 的数量,具备了当初中本聪设想的一个 CPU 一票的可能,同时增加的 CPU 会提升整个系统的资源,变相实现了记账权与提供资源之间的正比例关系。

      +
    10. +
    +

    共识机制有各自的优缺点,适应不同的场景:

    +

    image

    +
  6. +
  7. 激励层

    +

    激励层主要实现区块链代币的发行和分配机制,比如以太坊,定位以太币为平台运行的燃料,可以通过挖矿获得,每挖到一个区块固定奖励 5 个以太币,同时运行智能合约和发送交易都需要向矿工支付一定的以太币。

    +
  8. +
  9. 智能合约层

    +

    智能合约赋予账本可编程的特性,区块链2.0通过虚拟机的方式运行代码实现智能合约的功能,比如以太坊的以太坊虚拟机(EVM)。同时,这一层通过在智能合约上添加能够与用户交互的前台界面,形成去中心化的应用(DAPP)。当然,在某些技术文档中认为 DAPP 应该在智能合约层之上单独为应用层,也是有一定道理,只要不影响读者理解即可。

    +
  10. +
+

智能合约

智能合约简介

智能合约又称智能合同,是由事件驱动的、具有状态的、获得多方承认的、运行在区块链之上的、且能够根据预设条件自动处理资产的程序,智能合约最大的优势是利用程序算法替代人仲裁和执行合同。

+

本质上讲,智能合约也是一段程序,但是与传统的 IT 系统不同,智能合约继承了区块链的三个特性:数据透明、不可篡改、永久运行。

+
    +
  1. 数据透明

    +

    区块链上所有的数据都是公开透明的,因此智能合约的数据处理也是公开透明的,运行时任何一方都可以查看其代码和数据。

    +
  2. +
  3. 不可篡改

    +

    区块链本身的所有数据不可篡改,因此部署在区块链上的智能合约代码以及运行产生的数据输出也是不可篡改的,运行智能合约的节点不必担心其他节点恶意修改代码与数据。

    +
  4. +
  5. 永久运行

    +

    支撑区块链网络的节点往往达到数百甚至上千,部分节点的失效并不会导致智能合约的停止,其可靠性理论上接近于永久运行,这样就保证了智能合约能像纸质合同一样每时每刻都有效。

    +
  6. +
+

智能合约运行原理

通过最典型的以太坊为例简述智能合约运行的原理。

+
    +
  1. 以太坊虚拟机(EVM)

    +

    以太坊虚拟机(EVM)是以太坊中智能合约的运行环境。如果做比喻的话智能合约更像是 Java 程序,Java程序通过 Java 虚拟机(JVM)将代码解释字节进行执行,以太坊的智能合约通过以太坊虚拟机(EVM)解释成字节码进行执行。EVM 被沙箱封装起来,也就是说运行在 EVM 内部的代码不能接触到网络、文件系统或者其他进程,甚至智能合约之间也只有有限的调用。

    +
  2. +
  3. RPC接口

    +

    RPC接口是以太坊与其他IT系统交互的接口,以太坊节点在8545端口提供了 JSON RPC API 接口,数据传输采用 JSON 格式,可以执行 Web3 库的各种命令,可以向前端,比如 Mist 等图形化客户端提供区块链的信息。

    +

    智能合约是部署在区块链的代码,区块链本身不能执行代码,代码的执行是每个节点在本地通过太坊虚拟机(EVM)实现, 智能合约的运行原理如下图所示。

    +

    image

    +

    部署在区块链上的智能合约是一段能够在本地产生原智能合约代码的数据串,可以理解区块链为一个数据库,首先客户端通过发起一笔交易,告诉以太坊节点需要调用的函数及相关参数,然后所有的以太坊节点都会接收到这笔交易,从区块链这个数据库中读取了存储的智能合约运行代码,在本地EVM运行出结果,最后为避免节点作恶,节点运行智能合约的结果将与其他以太坊节点进行对比,确认无误后才将结果写入到了区块链中,从而实现智能合约的正确执行。

    +
  4. +
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2019/07/06/turn-off-windows-fast-startup/index.html b/2019/07/06/turn-off-windows-fast-startup/index.html new file mode 100644 index 00000000..61b0c4b9 --- /dev/null +++ b/2019/07/06/turn-off-windows-fast-startup/index.html @@ -0,0 +1,193 @@ + + + + + + + + + + + + Turn Off Windows Fast Startup | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Turn Off Windows Fast Startup +

+ +

Turn Off Windows Fast Startup

Access Windows NTFS partition from Linux need turn off windows fast startup.

+
    +
  1. Go to Control Panel > Power Options.
  2. +
  3. Click on ‘Chose what the closing lid does’.
  4. +
  5. Click to Enable setting that are unavailable yet (Needs administrator access).
  6. +
  7. Deselect ‘Turn On Fast Startup’ and Save Changes.
  8. +
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2019/07/13/design-patterns-card/design-patterns-card.pdf b/2019/07/13/design-patterns-card/design-patterns-card.pdf new file mode 100644 index 00000000..58effa8f Binary files /dev/null and b/2019/07/13/design-patterns-card/design-patterns-card.pdf differ diff --git a/2019/07/13/design-patterns-card/design-patterns-card_page_01.svg b/2019/07/13/design-patterns-card/design-patterns-card_page_01.svg new file mode 100644 index 00000000..20b57f81 --- /dev/null +++ b/2019/07/13/design-patterns-card/design-patterns-card_page_01.svg @@ -0,0 +1,12956 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/2019/07/13/design-patterns-card/design-patterns-card_page_02.svg b/2019/07/13/design-patterns-card/design-patterns-card_page_02.svg new file mode 100644 index 00000000..faaeaa1d --- /dev/null +++ b/2019/07/13/design-patterns-card/design-patterns-card_page_02.svg @@ -0,0 +1,11477 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/2019/07/13/design-patterns-card/index.html b/2019/07/13/design-patterns-card/index.html new file mode 100644 index 00000000..68ff33d2 --- /dev/null +++ b/2019/07/13/design-patterns-card/index.html @@ -0,0 +1,217 @@ + + + + + + + + + + + + Design patterns card | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Design patterns card +

+ +

Design patterns card

UML Page 1/2

image

+

UML Page 2/2

image

+

创建型模式

    +
  1. 单件模式(Single Pattern)
  2. +
  3. 抽象工厂模式(Abstract Factory)
  4. +
  5. 建造者模式(Builder Pattern)
  6. +
  7. 工厂方法(Factory Method)
  8. +
  9. 原型模式(Protype Pattern)
  10. +
+

结构型模式

    +
  1. 适配器模式(Adapter Pattern)
  2. +
  3. 桥接模式(Bridge Pattern)
  4. +
  5. 装饰模式(Decorator Pattern)
  6. +
  7. 组合模式(Composite Pattern)
  8. +
  9. 外观模式(Façade Pattern)
  10. +
  11. 享元模式(Flyweight Pattern)
  12. +
  13. 代理模式(Proxy Pattern)
  14. +
+

行为型模式

    +
  1. 模版方法模式(Template Method)
  2. +
  3. 命令模式(Command Pattern)
  4. +
  5. 迭代器模式(Iterator Pattern)
  6. +
  7. 观察者模式(Oberver Pattern)New!
  8. +
  9. 中介者模式(Mediator Pattern)
  10. +
  11. 备忘录模式(Memento Pattern)
  12. +
  13. 解释器模式(Interpreter Pattern)
  14. +
  15. 状态模式(State Pattern)
  16. +
  17. 策略模式(Strategy Pattern)
  18. +
  19. 职责链模式(Chain of Responsibility)
  20. +
  21. 访问者模式(Visitor Pattern)
  22. +
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2019/07/20/java-7-concurrent-executors-uml-class-diagram/index.html b/2019/07/20/java-7-concurrent-executors-uml-class-diagram/index.html new file mode 100644 index 00000000..71c612e5 --- /dev/null +++ b/2019/07/20/java-7-concurrent-executors-uml-class-diagram/index.html @@ -0,0 +1,187 @@ + + + + + + + + + + + + Java 7 concurrent executors UML class diagram | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Java 7 concurrent executors UML class diagram +

+ +

Java 7 concurrent executors UML class diagram

image

+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2019/07/20/java-7-concurrent-executors-uml-class-diagram/java-7-concurrent-executors-uml-class-diagram.png b/2019/07/20/java-7-concurrent-executors-uml-class-diagram/java-7-concurrent-executors-uml-class-diagram.png new file mode 100644 index 00000000..bbf41cda Binary files /dev/null and b/2019/07/20/java-7-concurrent-executors-uml-class-diagram/java-7-concurrent-executors-uml-class-diagram.png differ diff --git a/2019/07/27/jpa-entity-life-cycle/index.html b/2019/07/27/jpa-entity-life-cycle/index.html new file mode 100644 index 00000000..04247498 --- /dev/null +++ b/2019/07/27/jpa-entity-life-cycle/index.html @@ -0,0 +1,187 @@ + + + + + + + + + + + + JPA Entity Life Cycle | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ JPA Entity Life Cycle +

+ +

JPA Entity Life Cycle

image

+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2019/07/27/jpa-entity-life-cycle/jpa-entity-life-cycle.gif b/2019/07/27/jpa-entity-life-cycle/jpa-entity-life-cycle.gif new file mode 100644 index 00000000..65544825 Binary files /dev/null and b/2019/07/27/jpa-entity-life-cycle/jpa-entity-life-cycle.gif differ diff --git a/2019/07/27/jpa-entity-life-cycle/jpa-entity-life-cycle.png b/2019/07/27/jpa-entity-life-cycle/jpa-entity-life-cycle.png new file mode 100644 index 00000000..801c16f9 Binary files /dev/null and b/2019/07/27/jpa-entity-life-cycle/jpa-entity-life-cycle.png differ diff --git a/2019/08/03/systemd-s-journal-size/index.html b/2019/08/03/systemd-s-journal-size/index.html new file mode 100644 index 00000000..36040298 --- /dev/null +++ b/2019/08/03/systemd-s-journal-size/index.html @@ -0,0 +1,193 @@ + + + + + + + + + + + + Systemd's Journal Size | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Systemd's Journal Size +

+ +

Systemd’s Journal Size

journald.conf

1
2
3
4
5
6
7
8
9
$ grep -v "#" /etc/systemd/journald.conf
[Journal]
Compress=yes
SystemMaxUse=512M
SystemMaxFileSize=64M
RuntimeMaxUse=2048M
RuntimeMaxFileSize=64M

$ systemctl restart systemd-journald
+ +

Show total disk usage of all journal files

1
2
3
4
5
$ du -sh /var/log/journal
529M /var/log/journal

$ journalctl --disk-usage
Archived and active journals take up 528.0M on disk.
+ +

Reduce disk usage manually

1
2
3
4
5
6
# journalctl --vacuum-files=63
# journalctl --vacuum-time=7d
# journalctl --vacuum-size=512M

Vacuuming done, freed 104.0M of archived journals on disk.
journal verify
+ +

Verify journal file consistency

1
# journalctl --verify
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2019/08/10/aile-iterative-lean-design/agile-iterative-lean-design.jpg b/2019/08/10/aile-iterative-lean-design/agile-iterative-lean-design.jpg new file mode 100644 index 00000000..001a4857 Binary files /dev/null and b/2019/08/10/aile-iterative-lean-design/agile-iterative-lean-design.jpg differ diff --git a/2019/08/10/aile-iterative-lean-design/design-thinking.jpg b/2019/08/10/aile-iterative-lean-design/design-thinking.jpg new file mode 100644 index 00000000..937c0389 Binary files /dev/null and b/2019/08/10/aile-iterative-lean-design/design-thinking.jpg differ diff --git a/2019/08/10/aile-iterative-lean-design/index.html b/2019/08/10/aile-iterative-lean-design/index.html new file mode 100644 index 00000000..de041ab6 --- /dev/null +++ b/2019/08/10/aile-iterative-lean-design/index.html @@ -0,0 +1,188 @@ + + + + + + + + + + + + Aile iterative lean design | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Aile iterative lean design +

+ +

Aile iterative lean design

Design thinking module

image

+

Iteration instead of increment

image

+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2019/08/18/eight-tips-for-business-negotiation/index.html b/2019/08/18/eight-tips-for-business-negotiation/index.html new file mode 100644 index 00000000..2fe2a1be --- /dev/null +++ b/2019/08/18/eight-tips-for-business-negotiation/index.html @@ -0,0 +1,203 @@ + + + + + + + + + + + + Eight tips for business negotiation | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Eight tips for business negotiation +

+ +

商务谈判的八条技巧

谈判就和攻城略地一样充满凶险,陷阱,诱惑,虽然不动刀枪,但是谈判桌所带来的利益一点不亚于在战场上得到的收获。谈判和战争一样只是手段和形式,其最终目的就是利益的获得,军事谈判和政治谈判如此,商务谈判一样也是如此。

+

要做一个称职的谈判职手,就要做到如下几点,并达到炉火纯青的境界。

+

知己知彼,熟悉业务

这里有很多方面,比如你所要谈判的内容背景,将来的发展前景,对手的水平,业绩,商业背景,人员组成,以及他们谈判的风格。潜在的思路。以及尽量探测他们的谈判底限和实际预期。有时对方暗藏的观点甚至是陷阱你能一看便知,一点就透,这样,在谈判桌上也减少对方暗藏的目的蒙混过关。

+

当然,这也少不了谈判团队内部对于自己的观点、目标和退让条件有一个充分的沟通和交底,不管你采取的有几套谈判方案和策略,也不管你是开拓市场,或者是守住市场,也不管是进攻性质的谈判策略还是保守性质的退守方案,一个熟练精干的谈判团队是达到谈判目的,取得谈判胜利的先决条件。

+

不论是什么样的商务谈判,也不论什么样的谈判对手,作为谈判的你,首先应该对所谈判的业务十分熟悉,如果你什么都不知道,或者只是一知半解,与对方谈判时很容易被问倒,可能会哑口无言。出现这种情况,在商务谈判中是极为不利的,对方很可能会抓住你对业务的陌生,穷追猛打,达到对方的要求价码。

+

瞒天过海,暗度陈仓

你想知己知彼,百战不殆,那么对方也在千方百计的了解你方的底细,你不想让对方知道的,对方千方百计想知道,你想让对方知道的对方也不见得就会信,所以,采用虚虚实实的高招妙招,在不违法犯罪和社会良俗的情况下,适当散布对你方有利的消息,封锁不利的信息,通过社会和公众以及报纸、电视和网络等媒体的力量,来博得有利的筹码,让大众为你所用,也是高手过招的一项不错的资源。

+

绅士风度,以退为进

在谈判桌上,谈话当中一点要注意方式,即使对方所提的要求无论怎么不合理,甚至要挟,也不可搞个人攻击,那毕竟是为各自单位谋取利益的,各为其主嘛,同时,向对方表示决绝时,也不要把话说的很坚决,可以采取很委婉的辞令,比如:您所说的有一定道理,但和我单位的考虑方面和立场不同,等以后我们合作了,利益交汇点多了,我想会有就这一问题继续探讨的空间的。这样让对方觉得我们真的有合作的空间,我们的单位也是一个懂得谦让的企业,不至于让对方觉得我们就像敌人一样,从而至起码不会把对方从心理上推到真的成了敌人的境地。

+

谈判虽然和战场一样凶恶险峻,暗流汹涌,但是在谈判技巧上绝对不能失掉绅士风度,否则,别人很难把你真正当做一个谈判对手,只有具有高雅风度,海纳百川的人,在遭到对方故意刺激时,才能波澜不惊,喜怒不形于色,从而你不想被对方马上探知的观点和利益才能藏于虚虚实实的来往交锋之中,由于对方不知道你的真实意图和底限,就无从钻空子。

+

在谈判时,很可能会出现僵持的局面,即对方不让步,己方也不愿让步,如果谁都不退让,谈判就无法进行下去,我们应该要明确一点,就是我们是来谈判的,不是来把谈判弄成无话可谈的,既然双方坐到一起谈判,一定是为了某种利益或需求。所以在谈判发生僵局时,为了最终的目的,可以适时的退一步,对一些无关紧要的,可以做一些取舍。以小博大,也是一种智慧。

+

语言简洁,思路清晰

语言的简洁绝对是应该具备的,当你向对方亮明观点和筹码时,对方能立马明白你的要求,正所谓该明就明,该暗就暗,一定不能让对方主导谈判进程。

+

一个语言拖沓,思路不清的谈话,只能让对方觉得你不知所云,这不是看轻你个人的表达能力,是看轻你的背后企业或者公司的整体人才库质量,并进而对你的单位作出比较负面的判断。

+

感情接近,求同存异

说到感情接近可能不大好理解,但是说到求同存异,却好接受,海峡两岸的政治谈判难不难?但是也是采取的慢慢地来化解的方式,先求同存异,先经后政,先民后军,先易后难,先捡容易的、简单的来谈来做,等找到双方的利益结合点和交叉点,慢慢交流,逐渐加深感情,逐渐加大利益交接点,然后就会带动更大的利益结合点,这样在趟深水区的时候,双方所能找到的共同点也就越来越多了。

+

毕竟,谈判双方将来要做利益交换或者将来要合作,这才会存在谈判这一说法,所以没有必要把双方的关系在谈判场上搞僵。这是大忌。

+

偷梁换柱,移花接木

通过谈话,拉家常的形式,探知对方和自己观点相同的领域,慢慢引导对方拿出和你一致的观点,然后自己就像被拍接收对方的观点一样,来一个面不改色,暗度陈仓的招式,达到自己的目的。

+

小题大做,树立假目标

谈判就是一个虚虚实实的博弈过程,你要想把大目标谈成,只能把这个目的隐藏的严严的,或者给对方一个这是小问题的印象,所以即使答应了对方也不会受多大损失,同样为了达到这个目标的达成,你要想法设法把一个小问题或者小让步包装成一个大问题或者大让步,以期望让对方有一种均达成目的成就感。这就是小题大做,之所以“小题大做”,是为了树立一个假目标,释放一个烟雾弹,是为了“大题小做”的顺利实施,从而博得一个大的利益收获。

+

目标明确,抓大放小

谈判之前,一定要搞清楚己方所要达成的目标。你所谈判的话语,应该紧紧围绕着该目标。对手无论做什么让步,甚至是诱惑,你都不能改变己方目标,目标一旦确立就不要轻易改变,否则,谈判就没有了主心骨,只会被对方牵着走。

+

其实,所谓的谈判,简而言之,就是大家谈谈利益如何交换,判定交换的方式,数量以及大小。有得必有失,只不过双方都想在交出利益最小化的情况下博得尽可能最大化的利益而已,因此,要注意在达到自己的目的之后适当出让一部分相对比较小的利益,只有“放小”才可以“抓大”。如果一味的抱着既得利益不放,那只能把谈判对手谈走,从而失去合作机会甚至会把对手挤到和竞争对手的同盟行列。

+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2019/08/25/buildah-skopeo-and-podman/index.html b/2019/08/25/buildah-skopeo-and-podman/index.html new file mode 100644 index 00000000..deca4b3c --- /dev/null +++ b/2019/08/25/buildah-skopeo-and-podman/index.html @@ -0,0 +1,222 @@ + + + + + + + + + + + + Buildah, Skopeo and Podman | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Buildah, Skopeo and Podman +

+ +

Buildah, Skopeo and Podman

    +
  • Buildah is a tool for building Open Container Initiative (OCI) container images
  • +
  • Skopeo is a command line utility that performs various operations on container images and image repositories.
  • +
  • Podman is a tool for managing Pods, Containers, and Container Images
  • +
+

Buildah

The Buildah package provides a command line tool that can be used to:

+
    +
  • create a working container, either from scratch or using an image as a starting point
  • +
  • create an image, either from a working container or via the instructions in a Dockerfile
  • +
  • images can be built in either the OCI image format or the traditional upstream docker image format
  • +
  • mount a working container’s root filesystem for manipulation
  • +
  • unmount a working container’s root filesystem
  • +
  • use the updated contents of a container’s root filesystem as a filesystem layer to create a new image
  • +
  • delete a working container or an image
  • +
  • rename a local container
  • +
+

Skopeo

Skopeo is a command line utility that performs various operations on container images and image repositories.

+

Skopeo can work with OCI images as well as the original Docker v2 images.

+

Skopeo works with API V2 registries such as Docker registries, the Atomic registry, private registries, local directories and local OCI-layout directories. Skopeo does not require a daemon to be running to perform these operations which consist of:

+
    +
  • Copying an image from and to various storage mechanisms. For example you can copy images from one registry to another, without requiring privilege.
  • +
  • Inspecting a remote image showing its properties including its layers, without requiring you to pull the image to the host.
  • +
  • Deleting an image from an image repository.
  • +
  • When required by the repository, skopeo can pass the appropriate credentials and certificates for authentication
  • +
+

Podman

At a high level, the scope of libpod and Podman is the following:

+
    +
  • Support multiple image formats including the OCI and Docker image formats.
  • +
  • Support for multiple means to download images including trust & image verification.
  • +
  • Container image management (managing image layers, overlay filesystems, etc).
  • +
  • Full management of container lifecycle.
  • +
  • Support for pods to manage groups of containers together.
  • +
  • Resource isolation of containers and pods.
  • +
  • Support for a Docker-compatible CLI interface through Podman.
  • +
  • Integration with CRI-O to share containers and backend code.
  • +
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2019/08/31/openjdk-life-cycle/index.html b/2019/08/31/openjdk-life-cycle/index.html new file mode 100644 index 00000000..90c655fd --- /dev/null +++ b/2019/08/31/openjdk-life-cycle/index.html @@ -0,0 +1,256 @@ + + + + + + + + + + + + OpenJDK Life Cycle | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ OpenJDK Life Cycle +

+ +

OpenJDK Life Cycle

+

Oracle Java SE

+

Azul Zulu

+
1
2
3
4
5
podman run --rm --pull always docker.io/azul/zulu-openjdk:8 java -version
podman run --rm --pull always docker.io/azul/zulu-openjdk:11 java -version

podman run --rm --pull always docker.io/azul/zulu-openjdk:17-jre java -version
podman run --rm --pull always docker.io/azul/zulu-openjdk:17 java -version
+ +

RedHat

+

Eclipse Temurin (Adoptium’s JDKs)

+
1
2
3
4
5
6
7
8
9
10
11
podman run --rm --pull always docker.io/library/eclipse-temurin:11-jre java -version
podman run --rm --pull always docker.io/library/eclipse-temurin:11-jdk java -version

podman run --rm --pull always docker.io/library/eclipse-temurin:17-jre java -version
podman run --rm --pull always docker.io/library/eclipse-temurin:17-jdk java -version

docker run --rm --pull always eclipse-temurin:11-jre-nanoserver java -version
docker run --rm --pull always eclipse-temurin:11-jdk-nanoserver java -version

docker run --rm --pull always eclipse-temurin:17-jre-nanoserver java -version
docker run --rm --pull always eclipse-temurin:17-jdk-nanoserver java -version
+ +

Amazon Corretto

+

Microsoft Build of OpenJDK

+

Tencent Kona

+
1
2
podman run --rm --pull always docker.io/konajdk/konajdk:8 java -version
podman run --rm --pull always docker.io/konajdk/konajdk:11 java -version
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2019/09/01/java-memory-map/index.html b/2019/09/01/java-memory-map/index.html new file mode 100644 index 00000000..d844516e --- /dev/null +++ b/2019/09/01/java-memory-map/index.html @@ -0,0 +1,192 @@ + + + + + + + + + + + + Java Memory Map | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Java Memory Map +

+ +

Java Memory Map

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
$ jmap 1256 | grep ^0x | sort -k3
0x0000000000400000 7K /ci/jdk-8u152-linux-x64/bin/java
0x00007fd729e9c000 221K /ci/jdk-8u152-linux-x64/jre/lib/amd64/libjava.so
0x00007fd71422c000 49K /ci/jdk-8u152-linux-x64/jre/lib/amd64/libmanagement.so
0x00007fd714015000 112K /ci/jdk-8u152-linux-x64/jre/lib/amd64/libnet.so
0x00007fd70d7ee000 91K /ci/jdk-8u152-linux-x64/jre/lib/amd64/libnio.so
0x00007fd6cad8f000 251K /ci/jdk-8u152-linux-x64/jre/lib/amd64/libsunec.so
0x00007fd72a0c8000 64K /ci/jdk-8u152-linux-x64/jre/lib/amd64/libverify.so
0x00007fd729a6d000 125K /ci/jdk-8u152-linux-x64/jre/lib/amd64/libzip.so
0x00007fd72a7e1000 16640K /ci/jdk-8u152-linux-x64/jre/lib/amd64/server/libjvm.so
0x00007fd72bda4000 101K /ci/jdk-8u152-linux-x64/lib/amd64/jli/libjli.so
0x00007fd72c1d6000 160K /usr/lib64/ld-2.17.so
0x00007fd72b7dd000 2077K /usr/lib64/libc-2.17.so
0x00007fd72bba0000 19K /usr/lib64/libdl-2.17.so
0x00007fd6cab79000 86K /usr/lib64/libgcc_s-4.8.5-20150702.so.1
0x00007fd72a4df000 1112K /usr/lib64/libm-2.17.so
0x00007fd729c89000 60K /usr/lib64/libnss_files-2.17.so
0x00007fd72bfba000 141K /usr/lib64/libpthread-2.17.so
0x00007fd72a2d7000 43K /usr/lib64/librt-2.17.so
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2019/09/08/frequently-used-java-arguments/index.html b/2019/09/08/frequently-used-java-arguments/index.html new file mode 100644 index 00000000..2f26f63b --- /dev/null +++ b/2019/09/08/frequently-used-java-arguments/index.html @@ -0,0 +1,207 @@ + + + + + + + + + + + + Frequently used Java arguments | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Frequently used Java arguments +

+ +

Frequently used Java arguments

+

Language and encoding

1
2
3
-Duser.language=en \
-Duser.country=US \
-Dfile.encoding=UTF-8 \
+ +

Memory

1
2
3
4
5
6
7
8
-Xms1024M \
-Xmx1024M \
-Xss2M \
-XX:+UseLargePages \
-XX:+AlwaysPreTouch \
-XX:+PrintCommandLineFlags \
-XX:+HeapDumpOnOutOfMemoryError \
-XX:HeapDumpPath=/var/log/java_heapdump_%p.hprof \
+ +

Container support

1
2
3
4
5
6
7
8
9
-XX:+PrintContainerInfo \
-XX:+UseContainerSupport \
-XX:MinRAMPercentage=25 \
-XX:MaxRAMPercentage=75 \
-XX:+UseLargePages \
-XX:+AlwaysPreTouch \
-XX:+PrintCommandLineFlags \
-XX:+HeapDumpOnOutOfMemoryError \
-XX:HeapDumpPath=/var/log/java_heapdump_%p.hprof \
+ +

JMX

1
2
3
4
5
6
7
-Djava.rmi.server.hostname=<external IP> \
-Dcom.sun.management.jmxremote \
-Dcom.sun.management.jmxremote.local.only=false \
-Dcom.sun.management.jmxremote.ssl=false \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.port=18983 \
-Dcom.sun.management.jmxremote.rmi.port=18983 \
+ +

GC

GC log

1
2
3
4
5
6
7
8
9
-Xloggc:logs/gc.log \
-verbose:gc \
-XX:+DisableExplicitGC \
-XX:+PrintGCDetails \
-XX:+PrintGCDateStamps \
-XX:+PrintGCTimeStamps \
-XX:+UseGCLogFileRotation \
-XX:NumberOfGCLogFiles=2 \
-XX:GCLogFileSize=64M \
+ +

ParallelGC

1
2
-XX:+UseParallelGC \
-XX:+UseParallelOldGC \
+ +

ConcMarkSweepGC

1
2
3
4
-XX:+UseConcMarkSweepGC \
-XX:+UseParNewGC \
-XX:+CMSParallelRemarkEnabled \
-XX:+CMSClassUnloadingEnabled \
+ +

G1GC

1
2
-XX:+UseG1GC \
-XX:MaxGCPauseMillis=250 \
+ +

Misc

1
-Djava.awt.headless=true \
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2019/09/14/iptables/index.html b/2019/09/14/iptables/index.html new file mode 100644 index 00000000..5a876869 --- /dev/null +++ b/2019/09/14/iptables/index.html @@ -0,0 +1,193 @@ + + + + + + + + + + + + iptables | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ iptables +

+ +

iptables

List firewall rule

1
2
# iptables -L -n -v
# iptables-save
+ +

Flush or remove all iptables rules

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# filter (default), nat, mangle, raw, security
iptables -t filter -P INPUT ACCEPT
iptables -t filter -P FORWARD ACCEPT
iptables -t filter -P OUTPUT ACCEPT
iptables -t filter -F
iptables -t filter -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
iptables -t raw -F
iptables -t raw -X
iptables -t security -F
iptables -t security -X
+ +

NAT

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
sysctl net.ipv4.tcp_fin_timeout=15
sysctl net.ipv4.tcp_keepalive_intvl=75
sysctl net.ipv4.ip_forward=1
sysctl net.ipv4.conf.ens3.forwarding=1
sysctl net.ipv6.conf.ens3.forwarding=1

cat | iptables-restore << EOF
*filter
:INPUT ACCEPT
:FORWARD ACCEPT
:OUTPUT ACCEPT
COMMIT
*nat
:PREROUTING ACCEPT
:INPUT ACCEPT
:OUTPUT ACCEPT
:POSTROUTING ACCEPT
-A POSTROUTING -p esp -j RETURN
-A POSTROUTING -s 10.20.30.0/24 -o ens3 -j MASQUERADE
-A POSTROUTING -s 10.20.40.0/24 -o ens3 -j MASQUERADE
-A POSTROUTING -s 192.168.0.0/16 -o ens3 -j MASQUERADE
COMMIT
EOF
+ +

NFS

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
iptables -I INPUT 1 -m tcp -p tcp --dport 111 -j DROP
iptables -I INPUT 1 -m udp -p udp --dport 111 -j DROP

iptables -A INPUT -s 127.0.0.0/8 -p tcp -m state --state NEW,ESTABLISHED -m tcp --dport 2049 -j ACCEPT
iptables -A INPUT -s 127.0.0.0/8 -p udp -m state --state NEW,ESTABLISHED -m udp --dport 2049 -j ACCEPT

iptables -A INPUT -s 10.0.0.0/8 -p tcp -m state --state NEW,ESTABLISHED -m tcp --dport 2049 -j ACCEPT
iptables -A INPUT -s 10.0.0.0/8 -p udp -m state --state NEW,ESTABLISHED -m udp --dport 2049 -j ACCEPT

iptables -A INPUT -s 172.16.0.0/12 -p tcp -m state --state NEW,ESTABLISHED -m tcp --dport 2049 -j ACCEPT
iptables -A INPUT -s 172.16.0.0/12 -p udp -m state --state NEW,ESTABLISHED -m udp --dport 2049 -j ACCEPT

iptables -A INPUT -s 192.168.0.0/16 -p tcp -m state --state NEW,ESTABLISHED -m tcp --dport 2049 -j ACCEPT
iptables -A INPUT -s 192.168.0.0/16 -p udp -m state --state NEW,ESTABLISHED -m udp --dport 2049 -j ACCEPT

iptables -A INPUT -p tcp -m tcp --dport 2049 -j DROP
iptables -A INPUT -p udp -m udp --dport 2049 -j DROP
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2019/09/21/rest-api-error-handling-best-practices/index.html b/2019/09/21/rest-api-error-handling-best-practices/index.html new file mode 100644 index 00000000..bdc4fcd4 --- /dev/null +++ b/2019/09/21/rest-api-error-handling-best-practices/index.html @@ -0,0 +1,225 @@ + + + + + + + + + + + + REST API Error Handling Best Practices | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ REST API Error Handling Best Practices +

+ +

REST API Error Handling Best Practices

References

+

HTTP status

    +
  • https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
  • +
  • 200 OK
  • +
  • 201 Created
  • +
  • 202 Accepted
  • +
  • 204 No Content
  • +
  • 301 Moved Permanently
  • +
  • 304 Not Modified
  • +
  • 307 Temporary Redirect
  • +
  • 308 Permanent Redirect
  • +
  • 400 Bad Request
  • +
  • 401 Unauthorized
  • +
  • 403 Forbidden
  • +
  • 404 NOT FOUND
  • +
  • 405 Method Not Allowed
  • +
  • 409 Conflict
  • +
  • 410 Gone
  • +
  • 412 Precondition Failed
  • +
  • 429 Too Many Requests
  • +
  • 500 Internal Server Error
  • +
  • 501 Not Implemented
  • +
  • 502 Bad Gateway
  • +
  • 503 Service Unavailable
  • +
  • 508 Loop Detected
  • +
+

Sample

1
2
3
4
5
6
7
8
9
10
11
12
HTTP/1.1 403 Forbidden
Content-Type: application/problem+json
Content-Language: en

{
"timestamp":"2019-09-21 13:01:59.667+08:00",
"path":"/api/books/12345"
"status" : 403,
"code" : 123,
"error":"NoHostAvailable",
"message": "Your current balance is 30, but that costs 50."
}
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2019/09/28/design-principle/index.html b/2019/09/28/design-principle/index.html new file mode 100644 index 00000000..da8b1b87 --- /dev/null +++ b/2019/09/28/design-principle/index.html @@ -0,0 +1,195 @@ + + + + + + + + + + + + Design Principle | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Design Principle +

+ +

Design Principle

    +
  1. 单一职责原则 (Single Responsiblity Principle, SRP):每个类只有一个职责。
  2. +
  3. 开闭原则(Open Closed Principle,OCP):对扩展开放,对修改关闭。
  4. +
  5. 里氏代换原则(Liskov Substitution Principle,LSP):任何基类可以出现的地方,子类一定可以出现。
  6. +
  7. 依赖倒转原则(Dependency Inversion Principle,DIP):把父类都替换成它的子类,程序的行为没有变化。要依赖于抽象,不要依赖于具体。简单的说就是要求对抽象进行编程,不要对实现进行编程,这样就降低了客户与实现模块间的耦合。
  8. +
  9. 接口隔离原则(Interface Segregation Principle,ISP):每一个接口应该是一种角色,不多不少。使用多个隔离的接口,比使用单个接口要好。降低依赖,降低耦合。
  10. +
  11. 合成/聚合复用原则(Composite/Aggregate Reuse Principle,CARP):要尽量使用合成/聚合,尽量不要使用继承。
  12. +
  13. 最小知道原则(Principle of Least Knowledge,PLK,也叫迪米特法则):一个对象应对其他对象有尽可能少的了解。实体应当尽量少的与其他实体之间发生相互作用,使得系统功能模块相对独立。要求限制软件实体之间通信的宽度和深度。
  14. +
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2019/10/05/dragon-kill-point/index.html b/2019/10/05/dragon-kill-point/index.html new file mode 100644 index 00000000..1f208ccd --- /dev/null +++ b/2019/10/05/dragon-kill-point/index.html @@ -0,0 +1,202 @@ + + + + + + + + + + + + Dragon Kill Point | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Dragon Kill Point +

+ +

管理模式 DKP (Dragon Kill Point) 制度

转发自公司管理也可以”游戏化“,管理模式 DKP (Dragon Kill Point)制度分享

+

前言

游戏业,乃至整个互联网行业都是一个充满机会的行业,随时有些名不见经传的黑马,一炮打响,日进斗金,引来各方的羡慕嫉妒恨。而光环之下的特产就是 IT 民工,玩命加班不说,到头来老板开着法拉利跑了,苦逼们却连春运回家的车票都买不起,各式的悲催。

+

其实吃苦,咱真是不怕。吃得苦中苦,方为人上人,这道理我们懂。作家刘观德《我的财富在澳洲》里有个极精辟的五苦论——吃不着苦的“苦”比吃苦的“苦”还要“苦”,就因为这个,所以我们啥苦都忍了。所以大家怕的其实是竹篮打水一场空,苦都白吃了,所谓不怕黑社会,只怕社会黑。

+

创业企业,风险本身就大,和大公司比起来,一无所有,没钱没名没保障,偏偏创业者还总想拉几个牛人大碗下海,怎么办?老罗的演讲里面说了,画饼。DKP 制度就是尝试定义公平的分饼规则,简单易懂,清晰透明,较为可信。当然老板的 RP 得过得去,否则再好的制度也白搭,这个你都懂的。

+

DKP 制度

DKP 制度源于一些大型网游,里面往往有些怪物 Boss 需要很多的团队成员,夜以继日地战斗才能推到。而 Boss 又只掉落区区几件极品装备,这时候团队成员就需要有一套评估体系,来衡量各个成员的付出,这就是 DKP - Dragon Kill Point,直译就是杀龙分。游戏里面的 DKP 是一种可消耗资源,各个公会根据各自的惯例,让成员支付 DKP 分值来换取装备。

+

功劳和苦劳

对于创业团队成员来说,DKP 的按劳分配,多劳多得规则,可以坚定信念、鼓舞士气。总的来说,很简单,就是平衡好成员们的功劳和苦劳。

+

参与度

苦劳,其实就是参与度。

+

战士兄弟非常勤奋,一周五天,每天杀一条龙,那么就计做 5 分。而法师美眉则比较悠哉,谈谈情跳跳舞,每周就杀了一条龙,那就只有 1 分。

+

在实际创业团队里面,其实是不太可能有这种三天打鱼两天晒网的,除非是兼职的,否则几乎肯定为团队所不容。我们更经常遇到的,可能是加入团队有先后,那么苦劳这方面,肯定是从头至尾的累积的分数高。用分值来表达,只要完成了每月的任务,则按月获得一定的分数,参与了 10 个月的,势必比 5 个月的多,这道理一目了然。

+

重要性

功劳,其实就是其工作的重要性,用一个系数来表示。

+

战士杀的都是非常炮灰的小龙,那系数就设定为 0.5;而法师杀的是超大龙,那系数就设定为 2。

+

那两者的 DKP 结算也是非常简单的,实际团队的计算也是类似这样。

+

Happy Together

假设狩猎活动总计收益 100 万(可以看成项目盈利中可以拿来奖励的部分,注意不是全部收益),全团队的 DKP 总分为 10 分,那么每分就价值 10 万,战士哥哥可以分到 25 万,法师美眉可以分到 20 万,Happy Together?

+

嗯,我们的愿望就是 Happy Together,用户开心,投资人开心,我们也开心,多好,:)

+

注意事项

上述的体系很简单,操作起来如果要起到良好的效果,首先是注意透明化。系数来自工作的重要性,人在做,天在看,创业团队更是小到每个人都在看,谁的系数多少,不仅老大们要和队员当面确认,更是要做到拿出来大家都服气。此乃关键!

+

连坐也是一种平衡手段,苦劳部分是完成每个月定额任务才可以获得的分数,这个定额,是一级级的契约。战士组老大交给你每月 30 头龙的任务,你也认为 OK 接受了,那没完成的话,假设扣 10 分,你实际扣 8 分,老大扣 2 分。那下回老大少布置点任务是不是就 OK 了?不行,老大是和团长定的契约,团长直接面对的是副本进度,翻译过来就是市场档期、公司账面余额等等,无路可退。同样,战士组老大的扣分同样要分摊到团长头上,制定过高的目标,本来就是创业团队老大易犯的错误,分摊 DKP 扣分,天经地义,也可以帮助老大们清醒下打过鸡血的头脑。

+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2019/10/13/kubernetes-api-reference/index.html b/2019/10/13/kubernetes-api-reference/index.html new file mode 100644 index 00000000..6fb68211 --- /dev/null +++ b/2019/10/13/kubernetes-api-reference/index.html @@ -0,0 +1,233 @@ + + + + + + + + + + + + Kubernetes API Reference | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Kubernetes API Reference +

+ +

Kubernetes API Reference

+

Workloads APIs

    +
  • Container
  • +
  • DaemonSet
  • +
  • Deployment
  • +
  • Job
  • +
  • Pod
  • +
  • ReplicaSet
  • +
  • ReplicationController
  • +
  • StatefulSet
  • +
+

Service APIs

+

Config and Storage APIs

    +
  • ConfigMap
  • +
  • Secret
  • +
  • PersistentVolumeClaim
  • +
  • StorageClass
  • +
  • Volume
  • +
  • VolumeAttachment
  • +
+

Metadata APIs

+

Cluster APIs

    +
  • Binding
  • +
  • ComponentStatus
  • +
  • Namespace
  • +
  • Node
  • +
  • PersistentVolume
  • +
  • ResourceQuota
  • +
  • ServiceAccount
  • +
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2019/10/20/cqrs-ldc/index.html b/2019/10/20/cqrs-ldc/index.html new file mode 100644 index 00000000..5b3107cd --- /dev/null +++ b/2019/10/20/cqrs-ldc/index.html @@ -0,0 +1,187 @@ + + + + + + + + + + + + CQRS LDC | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ CQRS LDC +

+ +

CQRS LDC

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
CREATE TABLE IF NOT EXISTS CQRS_LDC_EVENT (
ID VARCHAR(36) NOT NULL,
AGGREGATE_ID VARCHAR(36) NOT NULL,
REVISION BIGINT NOT NULL,
-- ENTINY_ID VARCHAR(36) NOT NULL,
-- ENTINY_TYPE_ID VARCHAR(64) NOT NULL,

EVENT JSON NOT NULL CHECK (JSON_VALID(EVENT)),
TIMESTAMP DATETIME(6) NOT NULL DEFAULT LOCALTIMESTAMP,

-- EVENT JSONB NOT NULL,
-- EVENT JSON NOT NULL CHECK (JSON_VALID(EVENT)),
-- EVENT NVARCHAR(MAX) NOT NULL CHECK (ISJSON(EVENT)=1)
-- TIMESTAMP TIMESTAMP(6) NOT NULL DEFAULT LOCALTIMESTAMP,
-- TIMESTAMP DATETIME(6) NOT NULL DEFAULT LOCALTIMESTAMP,
-- TIMESTAMP DATETIME2(6) NOT NULL DEFAULT SYSDATETIME,

IS_PUBLISHED BOOLEAN NOT NULL DEFAULT TRUE, -- BOOLEAN, BIT
CORRELATION_ID VARCHAR(36),

CONSTRAINT CQRS_LDC_EVENT_PK PRIMARY KEY(ID),
CONSTRAINT CQRS_LDC_EVENT_AGGREGATE_ID_REVISION UNIQUE (AGGREGATE_ID, REVISION)
);

CREATE TABLE IF NOT EXISTS CQRS_LDC_SNAPSHOT (
ID VARCHAR(36) NOT NULL,
AGGREGATE_ID VARCHAR(36) NOT NULL,
REVISION BIGINT NOT NULL,

STATE JSONB NOT NULL,
TIMESTAMP TIMESTAMP(6) NOT NULL DEFAULT LOCALTIMESTAMP,

--STATE JSONB NOT NULL,
--STATE JSON NOT NULL CHECK (JSON_VALID(STATE)),
--STATE NVARCHAR(MAX) NOT NULL CHECK (ISJSON(STATE)=1)
--TIMESTAMP TIMESTAMP(6) NOT NULL DEFAULT LOCALTIMESTAMP,
--TIMESTAMP DATETIME(6) NOT NULL DEFAULT LOCALTIMESTAMP,
--TIMESTAMP DATETIME2(6) NOT NULL DEFAULT SYSDATETIME,

CONSTRAINT CQRS_LDC_SNAPSHOT_PK PRIMARY KEY(ID),
CONSTRAINT CQRS_LDC_SNAPSHOT_AGGREGATE_ID_REVISION UNIQUE (AGGREGATE_ID, REVISION)
);
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2019/10/27/editor-config/index.html b/2019/10/27/editor-config/index.html new file mode 100644 index 00000000..668385a5 --- /dev/null +++ b/2019/10/27/editor-config/index.html @@ -0,0 +1,197 @@ + + + + + + + + + + + + Editor Config | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Editor Config +

+ +

EditorConfig

+

What is EditorConfig?

EditorConfig helps maintain consistent coding styles for multiple developers working on the same project across various editors and IDEs. The EditorConfig project consists of a file format for defining coding styles and a collection of text editor plugins that enable editors to read the file format and adhere to defined styles. EditorConfig files are easily readable and they work nicely with version control systems.

+

EditorConfig Specification

+

Plugin Guidelines

+

Example file

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# top-most EditorConfig file
root = true

# default settings
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

indent_style = space
indent_size = 4
tab_width = 4

[Makefile]
indent_style = tab
tab_width = 4

[*.{bat,cmd}]
end_of_line = crlf

[*.{json,xml,xsd,yaml,yml}]
indent_style = space
indent_size = 2
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2019/11/02/java-build-information/index.html b/2019/11/02/java-build-information/index.html new file mode 100644 index 00000000..34d3e123 --- /dev/null +++ b/2019/11/02/java-build-information/index.html @@ -0,0 +1,194 @@ + + + + + + + + + + + + Java build information | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Java build information +

+ +

Detecting build version and time at runtime

It can often be useful to obtain information about artifact, version, build time and other at runtime.

+

Build plugin configuration

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54

<build>
<plugins>
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<executions>
<execution>
<id>git-commit-id</id>
<goals>
<goal>revision</goal>
</goals>
<phase>initialize</phase>
</execution>
</executions>
<configuration>
<generateGitPropertiesFile>true</generateGitPropertiesFile>
<generateGitPropertiesFilename>${project.build.outputDirectory}/META-INF/git.properties</generateGitPropertiesFilename>
</configuration>
</plugin>

<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<layout>ZIP</layout>
</configuration>
<executions>
<execution>
<id>build-info</id>
<goals>
<goal>build-info</goal>
</goals>
<configuration>
<additionalProperties>
<encoding.source>UTF-8</encoding.source>
<java.source>${maven.compiler.source}</java.source>
<java.target>${maven.compiler.target}</java.target>
<java.version>${java.version}</java.version>
<java.specification.version>${java.specification.version}</java.specification.version>
</additionalProperties>
<outputFile>${project.build.outputDirectory}/META-INF/build-info.properties</outputFile>
</configuration>
</execution>
<execution>
<id>repackage</id>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
+ +

Generated properties files

1
2
3
4
$ ls -l target/classes/META-INF/
total 4
-rwxrwxrwx 1 dongsheng dongsheng 288 Jan 1 1970 build-info.properties
-rwxrwxrwx 1 dongsheng dongsheng 895 Jan 1 1970 git.properties
+ +

Accessing Build Properties

Java Standard Library

1
2
3
4
5
6
7
8
9
try (InputStream inputStream = getClass().getClassLoader().getResourceAsStream("META-INF/git.properties")) {
Properties properties = new Properties();
properties.load(inputStream);
for (Map.Entry<Object, Object> e : properties.entrySet()) {
Object key = e.getKey();
Object value = e.getValue();
System.out.println(String.format("%s='%s'", key, value));
}
}
+ +

Spring Framework

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
@Autowired
private BuildProperties buildProperties;

@Autowired
private Environment environment;

buildProperties.getTime();
buildProperties.getGroup();
buildProperties.getArtifact();
buildProperties.getName();
buildProperties.getVersion();

buildProperties.get("property.name");

environment.getActiveProfiles();
environment.getProperty("property.name");
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2019/11/09/systemd-analyze/index.html b/2019/11/09/systemd-analyze/index.html new file mode 100644 index 00000000..cd8e2792 --- /dev/null +++ b/2019/11/09/systemd-analyze/index.html @@ -0,0 +1,190 @@ + + + + + + + + + + + + Systemd analyze | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Systemd analyze +

+ +

Systemd analyze

systemd-analyze may be used to determine system boot-up performance statistics and retrieve other state and tracing information from the system and service manager, and to verify the correctness of unit files. It is also used to access special functions useful for advanced system manager debugging.

+

Sample - SSD

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
$ systemd-analyze blame
6.939s NetworkManager-wait-online.service
6.360s plymouth-quit-wait.service
5.626s rabbitmq-server.service
4.604s docker.service
3.851s mysql.service
3.682s postgresql@11-main.service
1.250s keyboard-setup.service
1.189s motd-news.service
1.038s networking.service
996ms apparmor.service
972ms plymouth-start.service
921ms networkd-dispatcher.service
898ms ebtables.service
886ms plymouth-read-write.service
883ms systemd-backlight@backlight:intel_backlight.service
821ms udisks2.service
787ms ModemManager.service
769ms grub-common.service
761ms accounts-daemon.service
728ms dev-sda3.device
629ms NetworkManager.service
605ms systemd-logind.service
595ms alsa-restore.service
566ms systemd-resolved.service
489ms sysstat.service
488ms pppd-dns.service
479ms gpu-manager.service
474ms dnscrypt-proxy.service
396ms postfix@-.service
314ms systemd-rfkill.service
294ms rsyslog.service
289ms libvirtd.service
283ms chrony.service
276ms nfs-server.service
266ms nfs-mountd.service
226ms user@121.service
219ms systemd-journal-flush.service
217ms wpa_supplicant.service
192ms run-rpc_pipefs.mount
165ms swapfile.swap
165ms ssh.service
164ms lvm2-monitor.service
159ms systemd-tmpfiles-setup-dev.service
155ms proc-fs-nfsd.mount
148ms polkit.service
145ms packagekit.service
142ms systemd-udev-trigger.service
142ms systemd-journald.service
141ms gdm.service
133ms rpcbind.service
130ms systemd-modules-load.service
126ms containerd.service
124ms qemu-kvm.service
123ms dns-clean.service
114ms upower.service
111ms apport.service
104ms systemd-sysctl.service
98ms setvtrgb.service
88ms dev-mqueue.mount
87ms systemd-random-seed.service
82ms libvirt-guests.service
79ms kmod-static-nodes.service
77ms speech-dispatcher.service
77ms c.mount
77ms openvpn.service
72ms console-setup.service
67ms systemd-tmpfiles-setup.service
57ms nfs-idmapd.service
51ms systemd-udevd.service
51ms nginx.service
49ms user@1000.service
37ms nfs-blkmap.service
34ms systemd-networkd.service
33ms systemd-remount-fs.service
27ms blk-availability.service
25ms systemd-update-utmp.service
24ms systemd-user-sessions.service
22ms colord.service
21ms systemd-networkd-wait-online.service
20ms nfs-config.service
19ms systemd-tmpfiles-clean.service
16ms dev-hugepages.mount
15ms systemd-update-utmp-runlevel.service
15ms repmgrd.service
11ms sys-kernel-debug.mount
11ms ureadahead-stop.service
9ms sys-fs-fuse-connections.mount
7ms systemd-backlight@leds:dell::kbd_backlight.service
3ms sys-kernel-config.mount
3ms postfix.service
2ms postgresql.service
1ms docker.socket
+ +

Sample - HDD

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
$ systemd-analyze blame
28.145s docker.service
22.532s systemd-networkd-wait-online.service
14.102s udisks2.service
12.167s NetworkManager-wait-online.service
8.956s systemd-journal-flush.service
6.451s dev-mapper-os\x2droot.device
5.882s libvirtd.service
3.481s ModemManager.service
3.314s boot.mount
3.224s NetworkManager.service
3.006s accounts-daemon.service
2.438s lvm2-pvscan@8:19.service
2.337s avahi-daemon.service
2.203s sysstat.service
2.201s pppd-dns.service
2.198s rsyslog.service
2.026s wpa_supplicant.service
2.023s systemd-logind.service
2.023s switcheroo-control.service
2.022s alsa-restore.service
1.758s apparmor.service
1.534s systemd-networkd.service
1.371s systemd-tmpfiles-setup.service
1.312s binfmt-support.service
1.168s systemd-udevd.service
1.011s systemd-fsck@dev-disk-by\x2duuid-6FDA\x2d0B26.service
904ms boot-efi.mount
900ms nfs-mountd.service
800ms proc-fs-nfsd.mount
771ms ssh.service
681ms lvm2-monitor.service
647ms nfs-server.service
628ms gdm.service
535ms systemd-remount-fs.service
499ms polkit.service
477ms run-rpc_pipefs.mount
473ms dev-mapper-os\x2dswap.swap
426ms networking.service
393ms keyboard-setup.service
376ms systemd-udev-trigger.service
374ms systemd-journald.service
369ms nfs-idmapd.service
325ms systemd-sysusers.service
323ms colord.service
304ms systemd-modules-load.service
302ms libvirt-guests.service
293ms systemd-tmpfiles-setup-dev.service
268ms systemd-user-sessions.service
252ms upower.service
234ms openvpn.service
233ms containerd.service
206ms systemd-sysctl.service
204ms console-setup.service
202ms systemd-timesyncd.service
183ms systemd-rfkill.service
142ms systemd-random-seed.service
138ms kmod-static-nodes.service
130ms nfs-config.service
117ms systemd-tmpfiles-clean.service
110ms user@1000.service
102ms ifupdown-pre.service
96ms dev-mqueue.mount
89ms blk-availability.service
89ms sys-kernel-debug.mount
89ms dev-hugepages.mount
87ms systemd-update-utmp.service
48ms nfs-blkmap.service
23ms proc-sys-fs-binfmt_misc.mount
9ms user-runtime-dir@1000.service
7ms docker.socket
7ms systemd-update-utmp-runlevel.service
3ms sys-fs-fuse-connections.mount
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2019/11/16/generate-ca-certificates-for-java/index.html b/2019/11/16/generate-ca-certificates-for-java/index.html new file mode 100644 index 00000000..f96e7c38 --- /dev/null +++ b/2019/11/16/generate-ca-certificates-for-java/index.html @@ -0,0 +1,191 @@ + + + + + + + + + + + + Generate CA certificates for Java | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Generate CA certificates for Java +

+ +

Generate CA certificates for Java

packages

1
2
3
# dpkg -l | grep ca-certificates
ii ca-certificates 20190110 all Common CA certificates
ii ca-certificates-java 20190405 all Common CA certificates (JKS keystore)
+ +

generate cacerts

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
storepass='changeit'
JAR=/usr/share/ca-certificates-java/ca-certificates-java.jar

rm -f /etc/ssl/certs/java/cacerts
find /etc/ssl/certs -name \*.pem | \
while read filename; do
alias=$(basename $filename .pem | tr A-Z a-z | tr -cs a-z0-9 _)
alias=${alias%*_}
if [ -n "$FIXOLD" ]; then
echo "-${alias}"
echo "-${alias}_pem"
fi
echo "+${filename}"
done | \
java -Xmx64m -jar $JAR -storepass "$storepass"
+ +

results

1
2
3
4
5
6
7
8
ls -la /etc/ssl/certs/java/cacerts
sha256sum /etc/ssl/certs/java/cacerts

# ls -la /etc/ssl/certs/java/cacerts
-rw-r--r-- 1 root root 150689 2019-11-15 21:24 /etc/ssl/certs/java/cacerts

# sha256sum /etc/ssl/certs/java/cacerts
0d0041de796beaecfd8a2f859e3c642839fa9d6567d6da394fed2d001076c765 /etc/ssl/certs/java/cacerts
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2019/11/30/how-to-reverse-a-list-of-words-in-a-shell-string/index.html b/2019/11/30/how-to-reverse-a-list-of-words-in-a-shell-string/index.html new file mode 100644 index 00000000..cd1d8525 --- /dev/null +++ b/2019/11/30/how-to-reverse-a-list-of-words-in-a-shell-string/index.html @@ -0,0 +1,200 @@ + + + + + + + + + + + + How to reverse a list of words in a shell string? | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ How to reverse a list of words in a shell string? +

+ +

How to reverse a list of words in a shell string?

awk for loop

echo "$str" | awk '{for (i=NF; i>1; i--) printf("%s ", $i); print $1}'
+
+echo "$str" | awk '{for (i=NF; i>0; i--) printf("%s%s", $i, (i>1?OFS:ORS))}'
+
+

awk do loop

echo "$str" | awk '{do printf("%s%s", $NF, (NF>1?FS:RS)); while(--NF)}'
+
+

tac and tr

echo $str | tr ' ' '\n' | tac | tr '\n' ' '; echo
+
+echo -n "$str" | tac -s ' '
+
+tac -s ' ' <<< "$str" | xargs
+
+

string operator

rwo(){for((i=$
+
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2019/12/08/specify-a-timeout-using-a-non-blocking-method/index.html b/2019/12/08/specify-a-timeout-using-a-non-blocking-method/index.html new file mode 100644 index 00000000..5fec321e --- /dev/null +++ b/2019/12/08/specify-a-timeout-using-a-non-blocking-method/index.html @@ -0,0 +1,197 @@ + + + + + + + + + + + + Specify a timeout using a non-blocking method | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Specify a timeout using a non-blocking method +

+ +

Specify a timeout using a non-blocking method

Java 8

A simple implementation of timeoutAfter is as follows where delayer is an instance of a ScheduledThreadPoolExecutor:

+
1
2
3
4
5
public <T> CompletableFuture<T> timeoutAfter(long timeout, TimeUnit unit) {
CompletableFuture<T> result = new CompletableFuture<T>();
delayer.schedule(() -> result.completeExceptionally(new TimeoutException()), timeout, unit);
return result;
}
+ +

Timeout mechanism

+
1
2
3
CompletableFuture.supplyAsync(() -> findBestPrice("LDN - NYC"), executorService)
.thenCombine(CompletableFuture.supplyAsync(() -> queryExchangeRateFor("GBP")), this::convert)
.acceptEither(timeoutAfter(1, TimeUnit.SECONDS), amount -> System.out.println("The price is: " + amount + "GBP"));
+ +

Java 9 or later

Java 9’s CompletableFuture introduces several new methods amongst which are orTimeout and completeOnTimeOut that provide built-in support for dealing with timeouts.

+

The method orTimeout has the following signature:

+
1
2
public CompletableFuture<T> orTimeout(long timeout, TimeUnit unit);
public CompletableFuture<T> completeOnTimeout(T value, long timeout, TimeUnit unit);
+ +
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
CompletableFuture.supplyAsync(() -> findBestPrice("LDN - NYC"), executorService)
.thenCombine(CompletableFuture.supplyAsync(() -> queryExchangeRateFor("GBP")), this::convert)
.orTimeout(1, TimeUnit.SECONDS)
.whenComplete((amount, error) -> {
if (error == null) {
System.out.println("The price is: " + amount + "GBP");
} else {
System.out.println("Sorry, we could not return you a result");
}
});

CompletableFuture.supplyAsync(() -> findBestPrice("LDN - NYC"), executorService)
.thenCombine(CompletableFuture.supplyAsync(() -> queryExchangeRateFor("GBP")), this::convert)
.completeOnTimeout(DEFAULT_PRICE, 1, TimeUnit.SECONDS)
.thenAccept(amount -> {
System.out.println("The price is: " + amount + "GBP");
});
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2019/12/14/undo-a-git-merge-that-hasn-t-been-pushed-yet/index.html b/2019/12/14/undo-a-git-merge-that-hasn-t-been-pushed-yet/index.html new file mode 100644 index 00000000..25553feb --- /dev/null +++ b/2019/12/14/undo-a-git-merge-that-hasn-t-been-pushed-yet/index.html @@ -0,0 +1,207 @@ + + + + + + + + + + + + Undo a Git merge that hasn't been pushed yet | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Undo a Git merge that hasn't been pushed yet +

+ +

Undo a Git merge that hasn’t been pushed yet

reflog

The first step would be to use reflog to find the commit right before the merge:

+
1
$ git reflog
+ +

reset

Once you find the commit that you want to revert back to, use the reset command

+
1
$ git reset --hard <commit-hash>
+ +

close behind the merge

If the commit you want to get back to is only one behind HEAD, then you can instead use ORIG_HEAD as a shortcut in the reset command:

+
    +
  1. With modern Git, you can:
  2. +
+
1
git merge --abort
+ +
    +
  1. Older syntax:
  2. +
+
1
git reset --merge
+ +
    +
  1. Old-school:
  2. +
+
1
2
3
4
5
$ git reset --hard

or

$ git reset --hard ORIG_HEAD
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2019/12/22/overcoming-the-forgetting-curve/1400-figure1.jpg b/2019/12/22/overcoming-the-forgetting-curve/1400-figure1.jpg new file mode 100644 index 00000000..bf3a3dc0 Binary files /dev/null and b/2019/12/22/overcoming-the-forgetting-curve/1400-figure1.jpg differ diff --git a/2019/12/22/overcoming-the-forgetting-curve/1400-figure2.jpg b/2019/12/22/overcoming-the-forgetting-curve/1400-figure2.jpg new file mode 100644 index 00000000..42416f80 Binary files /dev/null and b/2019/12/22/overcoming-the-forgetting-curve/1400-figure2.jpg differ diff --git a/2019/12/22/overcoming-the-forgetting-curve/1400-figure3.jpg b/2019/12/22/overcoming-the-forgetting-curve/1400-figure3.jpg new file mode 100644 index 00000000..a372d087 Binary files /dev/null and b/2019/12/22/overcoming-the-forgetting-curve/1400-figure3.jpg differ diff --git a/2019/12/22/overcoming-the-forgetting-curve/1400-figure4.jpg b/2019/12/22/overcoming-the-forgetting-curve/1400-figure4.jpg new file mode 100644 index 00000000..3a925c3a Binary files /dev/null and b/2019/12/22/overcoming-the-forgetting-curve/1400-figure4.jpg differ diff --git a/2019/12/22/overcoming-the-forgetting-curve/1400-figure5.jpg b/2019/12/22/overcoming-the-forgetting-curve/1400-figure5.jpg new file mode 100644 index 00000000..10817d0f Binary files /dev/null and b/2019/12/22/overcoming-the-forgetting-curve/1400-figure5.jpg differ diff --git a/2019/12/22/overcoming-the-forgetting-curve/index.html b/2019/12/22/overcoming-the-forgetting-curve/index.html new file mode 100644 index 00000000..f0791c62 --- /dev/null +++ b/2019/12/22/overcoming-the-forgetting-curve/index.html @@ -0,0 +1,239 @@ + + + + + + + + + + + + Overcoming the Forgetting Curve | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Overcoming the Forgetting Curve +

+ +

Overcoming the Forgetting Curve

+

Students forget 70 percent of what we teach within 24 hours

While forgetting depends on many factors, research shows that, on average, +students forget 70 percent of what we teach within 24 hours of the training +experience (Figure 1). This is a “dirty secret of training” because while +we all know it is true, training organizations spend 60 billion dollars a +year on training programs knowing full well that most of that knowledge +will quickly disappear.

+

Figure 1 +Figure 1: The forgetting curve, training’s dirty secret

+

Forgetting is usually an active, adaptive, and even desirable process. +After all, most of the things we remember (like where we set our glasses), +are only of short-term importance, and after a day or so the brain needs +to suppress such time-limited memories in order to free space for +information that may be of more immediate value.

+

Coping with the forgetting curve

Coping with the forgetting curve

+

Figure 2 +Figure 2: The opportunity to recall pictures immediately after training significantly increased the chances that they remembered the information a week later

+

Figure 3 +Figure 3: More evidence that when you force a learner to recall information in the hours and days after training they are far more likely to retain that information in the long run

+

Use it or lose it

Why do booster opportunities cause the brain to retain information? One +explanation, based on the idea mentioned above, is that your brain wants +to retain information that is useful to you and purge information that +is not. And so, if you happen to call that information into your mind in +the hours and days after training, your brain tags that information as +important and is more likely to retain it. If you use it, you won’t lose it!

+

So what do these results mean for corporate and industrial training? In +short, if you provide your learners with booster events in the hours and +days after training you can reshape their forgetting curve. For example, +if you provide employees with a leadership seminar on Monday, you can +expect that most of this information will be lost within a week. However, +if you provide a booster event, such as a multiple-choice questionnaire, +it causes the learner to recall the information, which will reset the +learner’s forgetting curve (see Figure 4). Furthermore, strategically +providing a series of these booster events will reset the forgetting +curve each time and will maximize long-term retrieval (Figure 5).

+

Figure 4: A booster event “re-sets” a learner’s forgetting curve

+

Figure 5: A series of booster events maximizes long-term retrieval

+

An important note here is that these booster events improve retention for the +entire learning experience, and not just for the particular topics in the quiz +question. This “halo effect” means that just a few booster experiences can +enhance the retention of the entire training session.

+

A strategy for moving forward

Booster training provides an amazing opportunity to enhance the ROI of our +training programs. Let’s take our heads out of the sand and not allow the +forgetting curve to flush away 70 percent of our training. We can do better.

+

So here is a mantra to yell over the top of your cubicle. If your goal is to +produce long-term retention, and if your goal is to produce behavior change, +then what you do after training is more important than what you do during +training. If you do nothing, people will forget most of your training. However, +if you provide them with a series of booster experiences, you will signal the +learner’s brain that that particular information is important and, in turn, +they will be far more likely to remember it.

+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2019/12/22/overcoming-the-forgetting-curve/v2_1f7e815646314d1cb4b974f9883ece5f.jpg b/2019/12/22/overcoming-the-forgetting-curve/v2_1f7e815646314d1cb4b974f9883ece5f.jpg new file mode 100644 index 00000000..a0572eac Binary files /dev/null and b/2019/12/22/overcoming-the-forgetting-curve/v2_1f7e815646314d1cb4b974f9883ece5f.jpg differ diff --git a/2019/12/28/six-ways-to-improve-communication-skills/index.html b/2019/12/28/six-ways-to-improve-communication-skills/index.html new file mode 100644 index 00000000..ae09f448 --- /dev/null +++ b/2019/12/28/six-ways-to-improve-communication-skills/index.html @@ -0,0 +1,251 @@ + + + + + + + + + + + + Six ways to improve communication skills | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Six ways to improve communication skills +

+ +

提高沟通交流技能的六个方法

巴菲特曾经在回答一位青年企业家的提问时,提到了投资自我的最佳方式,就是去磨练自己的沟通交流技能。

+

养成每日坚持写日记的习惯

蒂莫西·费里斯(Tim Ferriss )是著名畅销书《每周工作4小时》(The 4-Hour Workweek)一书的作者。当被问及到他在采访当今的主流成功人士时,最常听到的行为习惯是什么的时候,费里斯称,其采访的成功人士中,有80%的人都有写日记的习惯。

+

这些成功人士之所以会坚持写日记,其原因也非常简单:要想产生个人影响力,就必须要做到逻辑清晰。除了把自己的所思所想记录下来之外,很少有其他行为习惯能快速地实现这个目标。

+

你可以尝试把常规面试问题的答案写下来,你也可以把自己最喜欢的故事记录下来,你还可以记录自己的读书笔记或者日常与他人沟通交流中的灵感启发。总之,只要有任何想法,你都可以尝试将它写下来。

+

如果你能养成习惯,每天预留一段时间,将自己的思想、梦想甚至恐惧写下来的话,当你再次去口头描述这些内容时,你会惊奇地发现,你在表达和描述过程中会如此地自信。

+

另外值得一提的是,当我三年前开始养成写日记的习惯过后,我说话口吃的现象也缓解了很多。最开始时,这个变化的确令我感到非常意外。但后来仔细想了想,它也的确有道理:毕竟,我不用再担心自己该说些什么,我只需要把我自己已经写下来的内容以口述的形式再次表达一遍罢了。

+

多看著名演讲,从中学习如何剖析

如果想要成为高效沟通者,你就必须全面了解高效沟通在人眼中到底是怎样体现的。多看著名演讲,从中学习如何剖析,就是很好的切入点。

+

就我个人而言,我特别喜欢收看西班牙IESE商学院教授领导力沟通的教授康纳·尼尔(Conor Neill)、著名营销大师赛斯·高汀(Seth Godin)、知名TED演讲者梅尔·罗宾斯(Mel Robbins),以及黄金圈法则发明人西蒙·斯涅克(Simon Sinek)的演讲视频。

+

值得注意的是,在观看相关视频之前,你一定要首先了解并清楚以下这些问题的答案,否则你可能就会做“无用功”。

+

关于演讲开篇内容

    +
  • 演讲者在演讲开始时如何吸引观众的?你是否被他的第一句话所吸引?
  • +
  • 他们是通过讲述个人故事,还是通过一段令人震惊的内容来开篇的?
  • +
  • 听完演讲着的开篇过后,你是基于什么目的还想继续观看后段内容的?是其相关性吗?还是出于个人好奇心?
  • +
+

关于演讲主要内容

    +
  • 演讲主旨结构是否清晰(优秀的演讲者通常都是优秀的简化者)?
  • +
  • 演讲者通过自身真实故事建立与听众的情感联系的频率如何?
  • +
  • 演讲者从一个论点过渡到另一个论点的过程中,使用了哪些词语或句子?在这些过渡过程中,你是否留意到演讲者语调的变化?
  • +
  • 演讲者在演讲过程中暂停的频率如何?你认为他们在这些时候停下来的原因是什么?
  • +
  • 演讲者在演讲过程中使用隐喻、类比和象征手段等方式来促进听众理解和简化复杂思想的?
  • +
+

关于演讲结尾部分

    +
  • 演讲者的结尾是否清晰、简明,并且让人印象深刻?
  • +
  • 演讲者是否会再次提到在开篇中讲过的故事,或者又是否会再次点出核心主题?
  • +
  • 如果演讲者在结尾提出了某种行为号召,那你是否因此而受感染?
  • +
+

关于非言语沟通

    +
  • 在整个演讲过程中,演讲者是否与观众保持着良好的眼神交流?
  • +
  • 演讲者全程是站立的,还是坐立的?其是否正视前方、面部肌肉放松,给人一种积极的心态?
  • +
  • 在演讲过程中,他们的手又放在哪里的?他们是否在不停地做着各种手势?你是否又发现其出现了坐立不安的时刻?
  • +
  • 演讲者在整个演讲过程从头到尾是否都保持着轻松的状态?如果在演讲过程中犯了错,他们又是如何挽救这个局面的?
  • +
  • 当演讲者想重点强调某个观点时,他们的肢体语言是否有什么变化?
  • +
  • 演讲者的着装如何?是否能反映其个人性格和演讲的风格?
  • +
+

当你在观看著名演讲视频时,你可以不停地问自己这些问题,从而让你更深层次地了解成为高效沟通者的方方面面。你可能会发现,有些演讲者在这些方面表现得都非常轻松,但无论他们表现得有多么“自然”,他们背后在每项内容上都花了大量时间来练习。

+

观察身边的高效沟通者

观看著名演讲视频是一种不错的方法,但如果随时留意日常生活中高效沟通者的言语行为,也是一种有效的方式。无论是正式会议、街上偶遇,还是办公室闲聊,你都有机会从身边自信沟通者身上学习。

+

以下,就是你值得关注的额外问题:

+
    +
  • 当他们来找你的时候,其有什么肢体语言?他们的眼神会让你感到舒适吗?他们会面带笑容吗?
  • +
  • 他们又是如何向你引出他们想要提出的问题的?他们是通过“让我好奇的是”等句子来直接引出话题,还是会说“我希望了解的是,就你个人而言,你对这个事情有什么看法?”
  • +
  • 他们更注重倾听还是更喜欢自说自话?当他们没有说话的时候,其姿势又是如何的?又是如何让你感受到对方在听你说话的?他们在承诺支持你的时候,是否会轻微地触碰你?对此,你又作何感想?
  • +
  • 当他们突然要去忙其它事情时,在退出聊天过程中,是否表现得非常礼貌?他们是否出现了坐立不安或者身体开始朝门口方向移动的倾向?他们又是否会立即打断别人的说话,还是会耐心地等待他人发言后,再跟对方说再见?他们又是如何说再见的?
  • +
  • 当对方情绪低落或焦躁的时候,其非言语表达和言语表达又有哪些变化?他们是否会提高自己的声调,从而来掌控整个聊天过程?或者他们是否仍然保持冷静的状态,让身边的人享有自由表达的空间?
  • +
  • 当他们在公布坏消息时,其语气有什么变化?他们又是否会通过讲述与个人缺点相关的故事来舒缓当事人的复杂情绪呢?
  • +
+

一定要认真分析研究身边自信的沟通者,特别注意他们在应对及处理复杂情形的方式,同时注意他们在这个过程中所指用的言语。在某些情况下,你还可以以书面方式记录有关感想。

+

此外,你也应该留意与他们沟通交流人士的反应。当你觉得他们的沟通表达方式不清晰时,你可以尝试在站对方角度,思考可以如何改进这些不恰当的沟通方式。

+

无论什么时候,我们都有许多提高自我沟通交流技巧的机会。我们需要做的是,多留意身边的人是如何与他人沟通的,然后从中有选择性地挑选适合自身的方式来学习。

+

每天用设备记录自己对自己说话,时间至少3分钟

根据我的朋友、YouTube平台订阅量非常大的领导力及沟通交流频道上传者康纳·尼尔(Conor Neill),要想提高自我沟通交流能力,最有效的方式之一,就是用身边的设备记录自己说话的过程。

+

你可以尝试用摄像头记录自己回答各种刁钻面试问题的过程。在出现错误的时候,及时记录有关笔记;当然,在表现良好的时候,你也可以把它记录下来。最好每天能持之以恒地重复这个练习。也许用不了多久,你就会惊奇地发现,原来自己在沟通表达方面提升了这么多。

+

当你能做到自信地回答这些面试问题过后,你可以尝试其它话题,比如讲述自己喜欢的故事,或者讲述自己观看演讲视频后的观后感,并且在这个过程中做出必要的调整,从而让自己的讲述更有吸引力和感染力。

+

与我而言,我喜欢讲述自己曾经写过的文章,或者会进一步探讨讲述日记中所记录的想法。每天花几分钟坚持这样的练习,不久之后,你可能会惊奇地发现,不仅是你的沟通表达能力,而且还有你的自信心,都会得到一定程度的提高。

+

每周请教一位你钦佩的人物

在我小时候,我的父亲曾告诉我,要想实现你的目标,最快的方式就是去发现和了解那些和你有相同目标的人是如何做的。

+

从2018年起,我就会刻意在每周预留一个小时空余时间,去接触并请教那些我比较钦佩的人物。

+

通过这种主动方式,让自己与所钦佩人物正面接触,可以迫使你提前做好有关准备,从而在宝贵的时间里向对方提出有意义的问题。你也可以把这个请教过程,当作一个高效速成课程,加速你的学习曲线,从而让你更加快速、精准地提出相关问题。

+

除了能够提高语言沟通能力之外,这项练习还能帮助你进一步加强写作沟通能力。对你自己非常钦佩的人物而言,他们很有可能会非常在意是否愿意花时间与你沟通。因此,这也可以迫使严谨地向对方靠近,向对方介绍你自己,同时解释为什么你想跟对方沟通。

+

要想练习这项沟通方式,你可以试试领英。在领英平台,如果你想加某人为好友的话,你还可以给对方发送不超过300字的私信。所以,通过这项练习,你还可以进一步简化自己的言语,让每个字都有它存在的意义。

+

无论何时何地,找机会自愿教授他人

10年前,当我搬去巴塞罗那的时候,我在当地一个机构教英语,从而勉强维持生计。出去教英语,虽然非常浪费个人时间,但它的确是我走投无路的办法,当时也没有更好的选择。

+

然而,最后我发现,这个决策,是我职业生涯中最正确的决策之一。

+

在日常准备教案的过程中,为了让我的课程生动有趣,我会想方设法地让自己的教案更加有趣。除此之外,这也是一项锻炼自己用最简洁语言与他人沟通的方法。毕竟,如果我想让自己的学生听懂我所讲授的内容,那我就必须要使用他们能够听懂的语言。

+

也许你可能还无法教别人英语,但你总是可以找到自己擅长的一面,并且向自己身边的人讲授有关内容。

+

比如,在职场中,你可以尝试从为新入职员工介绍有关工作内容,并且与他们分享你的工作经验,到最后你甚至可以毛遂自荐地为整个团队提供有关主题的培训课程。

+

机会哪里都有,只要你善于发现,就一定能找到为他人讲授的机会。通过这种方式,你可以大幅度地提升自己在将复杂问题简单表达化方面的技能,同时还可以总结学习如何能够让他人更加注意你的讲述内容。

+

写在最后……

环顾四周,放眼全球,看看那些与众不同、成绩斐然的人物。你会发现,所有人都是高效沟通者这个事实,绝不是一个巧合。而这个事实,也成为了区别好和优秀的核心区别因素,无论是职业生涯中,还是个人人际关系中,这个事实都有它存在的意义。

+

正如巴菲特曾说,如果你不去与他人沟通交流,清楚地表达你的观点,那你就是在埋没你的潜质。

+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/01/01/wireguard-next-generation-network-tunnel/index.html b/2020/01/01/wireguard-next-generation-network-tunnel/index.html new file mode 100644 index 00000000..aea4fa42 --- /dev/null +++ b/2020/01/01/wireguard-next-generation-network-tunnel/index.html @@ -0,0 +1,265 @@ + + + + + + + + + + + + WireGuard - Next Generation Network Tunnel | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ WireGuard - Next Generation Network Tunnel +

+ +

WireGuard

+

WireGuard® is an extremely simple yet fast and modern VPN that utilizes state-of-the-art cryptography. It aims to be faster, simpler, leaner, and more useful than IPsec, while avoiding the massive headache. It intends to be considerably more performant than OpenVPN. WireGuard is designed as a general purpose VPN for running on embedded interfaces and super computers alike, fit for many different circumstances. Initially released for the Linux kernel, it is now cross-platform (Windows, macOS, BSD, iOS, Android) and widely deployable. It is currently under heavy development, but already it might be regarded as the most secure, easiest to use, and simplest VPN solution in the industry.

+
    +
  • Simple & Easy-to-use
  • +
  • Cryptographically Sound
  • +
  • Minimal Attack Surface
  • +
  • High Performance
  • +
  • Well Defined & Thoroughly Considered
  • +
+

Conceptual Overview

WireGuard securely encapsulates IP packets over UDP. You add a WireGuard interface, configure it with your private key and your peers’ public keys, and then you send packets across it. All issues of key distribution and pushed configurations are out of scope of WireGuard; these are issues much better left for other layers, lest we end up with the bloat of IKE or OpenVPN. In contrast, it more mimics the model of SSH and Mosh; both parties have each other’s public keys, and then they’re simply able to begin exchanging packets through the interface.

+

Simple Network Interface

WireGuard works by adding a network interface (or multiple), like eth0 or wlan0, called wg0 (or wg1, wg2, wg3, etc). This network interface can then be configured normally using ifconfig(8) or ip-address(8), with routes for it added and removed using route(8) or ip-route(8), and so on with all the ordinary networking utilities. The specific WireGuard aspects of the interface are configured using the wg(8) tool. This interface acts as a tunnel interface. WireGuard associates tunnel IP addresses with public keys and remote endpoints.

+

Cryptokey Routing

At the heart of WireGuard is a concept called Cryptokey Routing, which works by associating public keys with a list of tunnel IP addresses that are allowed inside the tunnel. Each network interface has a private key and a list of peers. Each peer has a public key. Public keys are short and simple, and are used by peers to authenticate each other. They can be passed around for use in configuration files by any out-of-band method, similar to how one might send their SSH public key to a friend for access to a shell server.

+

When sending packets, the list of allowed IPs behaves as a sort of routing table, and when receiving packets, the list of allowed IPs behaves as a sort of access control list.

+

This is what we call a Cryptokey Routing Table: the simple association of public keys and allowed IPs.

+

Any combination of IPv4 and IPv6 can be used, for any of the fields. WireGuard is fully capable of encapsulating one inside the other if necessary.

+

Because all packets sent on the WireGuard interface are encrypted and authenticated, and because there is such a tight coupling between the identity of a peer and the allowed IP address of a peer, system administrators do not need complicated firewall extensions, such as in the case of IPsec, but rather they can simply match on “is it from this IP? on this interface?”, and be assured that it is a secure and authentic packet. This greatly simplifies network management and access control, and provides a great deal more assurance that your iptables rules are actually doing what you intended for them to do.

+

Built-in Roaming

The client configuration contains an initial endpoint of its single peer (the server), so that it knows where to send encrypted data before it has received encrypted data. The server configuration doesn’t have any initial endpoints of its peers (the clients). This is because the server discovers the endpoint of its peers by examining from where correctly authenticated data originates. If the server itself changes its own endpoint, and sends data to the clients, the clients will discover the new server endpoint and update the configuration just the same. Both client and server send encrypted data to the most recent IP endpoint for which they authentically decrypted data. Thus, there is full IP roaming on both ends.

+

Ready for Containers

WireGuard sends and receives encrypted packets using the network namespace in which the WireGuard interface was originally created. This means that you can create the WireGuard interface in your main network namespace, which has access to the Internet, and then move it into a network namespace belonging to a Docker container as that container’s only interface. This ensures that the only possible way that container is able to access the network is through a secure encrypted WireGuard tunnel.

+

NAT and Firewall Traversal Persistence

By default, WireGuard tries to be as silent as possible when not being used; it is not a chatty protocol. For the most part, it only transmits data when a peer wishes to send packets. When it’s not being asked to send packets, it stops sending packets until it is asked again. In the majority of configurations, this works well. However, when a peer is behind NAT or a firewall, it might wish to be able to receive incoming packets even when it is not sending any packets. Because NAT and stateful firewalls keep track of “connections”, if a peer behind NAT or a firewall wishes to receive incoming packets, he must keep the NAT/firewall mapping valid, by periodically sending keepalive packets. This is called persistent keepalives. When this option is enabled, a keepalive packet is sent to the server endpoint once every interval seconds. A sensible interval that works with a wide variety of firewalls is 25 seconds. Setting it to 0 turns the feature off, which is the default, since most users will not need this, and it makes WireGuard slightly more chatty. This feature may be specified by adding the PersistentKeepalive = field to a peer in the configuration file, or setting persistent-keepalive at the command line. If you don’t need this feature, don’t enable it. But if you’re behind NAT or a firewall and you want to receive incoming connections long after network traffic has gone silent, this option will keep the “connection” open in the eyes of NAT.

+

Installation

+

WireGuard for Windows

+

Ubuntu ≥ 19.10

1
sudo apt install wireguard
+ +

Ubuntu ≤ 19.04

1
2
3
sudo add-apt-repository ppa:wireguard/wireguard
sudo apt-get update
sudo apt-get install wireguard
+ +

Debian

1
2
3
4
5
6
7
8
echo "deb http://deb.debian.org/debian/ unstable main" | sudo tee /etc/apt/sources.list.d/unstable.list
printf 'Package: *\nPin: release a=unstable\nPin-Priority: 90\n' | sudo tee /etc/apt/preferences.d/limit-unstable
sudo apt update
sudo apt install wireguard

sudo apt dist-upgrade
sudo apt install linux-headers-amd64
sudo apt-get install --reinstall wireguard-dkms
+ +

Quick Start

Key Generation

1
2
3
4
5
6
7
umask 077

wg genkey > privatekey
wg pubkey < privatekey > publickey

# do this all at once
wg genkey | tee privatekey | wg pubkey > publickey
+ +

Server configuration

# sudo sysctl net.ipv4.conf.all.forwarding=1
+# sudo sysctl net.ipv6.conf.all.forwarding=1
+# sudo vi /etc/wireguard/wg0.conf
+[Interface]
+PrivateKey = YMKtNQbqzIL37gFZPue1rxITRWfwb828bvFqpbiMZ00=
+ListenPort = 24618
+
+# OP-7020-01
+[Peer]
+PublicKey = YMKtNQbqzIL37gFZPue1rxITRWfwb828bvFqpbiMZ00=
+AllowedIPs = 192.168.20.2/32
+PersistentKeepalive = 25
+
+

Client configuration

# sudo sysctl net.ipv4.conf.all.forwarding=1
+# sudo sysctl net.ipv6.conf.all.forwarding=1
+# sudo vi /etc/wireguard/wg0.conf
+# sudo wg setconf wg0 /etc/wireguard/wg0.conf
+# qrencode -t png -o ipv4-tunnel-by-ipv4.png < ipv4-tunnel-by-ipv4.conf
+[Interface]
+PrivateKey = YMKtNQbqzIL37gFZPue1rxITRWfwb828bvFqpbiMZ00=
+ListenPort = 6474
+
+[Peer]
+PublicKey = 8IFM9l26YZF0Xs3QPK88j87iE/gUrTRyi2n9I5WjH2c=
+Endpoint = 26.73.12.47:24618
+AllowedIPs = 0.0.0.0/0
+PersistentKeepalive = 25
+
+

Command-line Interface

Server side

Server route
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
iptables -L -n -v

iptables -t filter -P INPUT ACCEPT
iptables -t filter -P FORWARD ACCEPT
iptables -t filter -P OUTPUT ACCEPT
iptables -t filter -F
iptables -t filter -X
iptables -t nat -F
iptables -t nat -X

cat | iptables-restore << EOF
*filter
:INPUT ACCEPT
:FORWARD ACCEPT
:OUTPUT ACCEPT
-A FORWARD -i wg0 -j ACCEPT
COMMIT
*nat
:PREROUTING ACCEPT
:INPUT ACCEPT
:OUTPUT ACCEPT
:POSTROUTING ACCEPT
-A POSTROUTING -p esp -j RETURN
-A POSTROUTING -s 10.20.30.0/24 -o ens3 -j MASQUERADE
-A POSTROUTING -s 10.20.40.0/24 -o ens3 -j MASQUERADE
-A POSTROUTING -s 192.168.0.0/16 -o ens3 -j MASQUERADE
COMMIT
EOF
+ +
wg-quick
1
2
3
4
5
6
7
8
9
10
11
12
# sudo wg setconf wg0 /etc/wireguard/wg0.conf
# sudo systemctl enable wg-quick@wg0

sudo ip link add dev wg0 type wireguard
sudo ip addr add dev wg0 192.168.20.1/24
sudo ip link set dev wg0 up mtu 1420
sudo ip link set up dev wg0

sudo wg setconf wg0 /etc/wireguard/wg0.conf

sudo wg show
sudo wg showconf wg0
+ +

Client side

1
2
3
4
5
6
7
8
9
10
11
12
# sudo wg setconf wg0 /etc/wireguard/wg0.conf
# sudo systemctl enable wg-quick@wg0

sudo ip link add dev wg0 type wireguard
sudo ip addr add dev wg0 192.168.20.2/24
sudo ip link set dev wg0 up mtu 1420
sudo ip link set up dev wg0

sudo wg setconf wg0 /etc/wireguard/wg0.conf

sudo wg show
sudo wg showconf wg0
+ +
1
2
3
4
5
6
7
8
9
10
11
$ sudo wg-quick up wg0
[#] ip link add wg0 type wireguard
[#] wg setconf wg0 /dev/fd/63
[#] ip -4 address add 192.168.20.3/32 dev wg0
[#] ip link set mtu 1420 up dev wg0
[#] wg set wg0 fwmark 51820
[#] ip -4 route add 0.0.0.0/0 dev wg0 table 51820
[#] ip -4 rule add not fwmark 51820 table 51820
[#] ip -4 rule add table main suppress_prefixlength 0
[#] sysctl -q net.ipv4.conf.all.src_valid_mark=1
[#] nft -f /dev/fd/63
+ +
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$ ping -OD 192.168.20.1
PING 192.168.20.1 (192.168.20.1) 56(84) bytes of data.
[1584754074.675552] 64 bytes from 192.168.20.1: icmp_seq=1 ttl=64 time=176 ms
[1584754075.677335] 64 bytes from 192.168.20.1: icmp_seq=2 ttl=64 time=177 ms
[1584754076.680005] 64 bytes from 192.168.20.1: icmp_seq=3 ttl=64 time=178 ms
[1584754077.679841] 64 bytes from 192.168.20.1: icmp_seq=4 ttl=64 time=176 ms
[1584754078.682989] 64 bytes from 192.168.20.1: icmp_seq=5 ttl=64 time=177 ms
[1584754079.683023] 64 bytes from 192.168.20.1: icmp_seq=6 ttl=64 time=176 ms
[1584754080.696269] 64 bytes from 192.168.20.1: icmp_seq=7 ttl=64 time=188 ms
[1584754081.684687] 64 bytes from 192.168.20.1: icmp_seq=8 ttl=64 time=176 ms
[1584754082.687258] 64 bytes from 192.168.20.1: icmp_seq=9 ttl=64 time=178 ms
^C
--- 192.168.20.1 ping statistics ---
9 packets transmitted, 9 received, 0% packet loss, time 17ms
rtt min/avg/max/mdev = 175.802/177.997/188.254/3.769 ms
+ +

Client route

1
2
3
4
5
6
7
8
9
10
11
12
13
sudo ip route add 192.168.20.0/24 via 192.168.20.2 dev wg0

sudo ip route add 26.73.12.47/32 via 192.168.1.1
sudo ip route add 8.8.8.8/32 via 192.168.20.2 dev wg0
sudo ip route add 8.8.4.4/32 via 192.168.20.2 dev wg0
sudo ip route add 128.0.0.0/1 via 192.168.20.2 dev wg0
sudo ip route add 0.0.0.0/1 via 192.168.20.2 dev wg0

sudo ip route del 26.73.12.47/32
sudo ip route del 8.8.8.8/32
sudo ip route del 8.8.4.4/32
sudo ip route del 0.0.0.0/1
sudo ip route del 128.0.0.0/1
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/01/05/sql-insert-on-conflict/index.html b/2020/01/05/sql-insert-on-conflict/index.html new file mode 100644 index 00000000..5f85829d --- /dev/null +++ b/2020/01/05/sql-insert-on-conflict/index.html @@ -0,0 +1,218 @@ + + + + + + + + + + + + SQL insert on conflict | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ SQL insert on conflict +

+ +

SQL insert on conflict

PostgreSQL

+
1
2
3
4
5
6
7
INSERT INTO MYBAAS(ID, TYPE_NAME, JSON)
VALUES(?, ?, ?)
ON CONFLICT(ID) DO UPDATE SET TYPE_NAME=?, JSON=?

INSERT INTO MYBAAS(ID, TYPE_NAME, JSON)
VALUES(?, ?, ?)
ON CONFLICT DO NOTHING;
+ +

SQL Server

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
CREATE TABLE MYBAAS (
ID VARCHAR(64) NOT NULL,
TYPE_NAME VARCHAR(64) NOT NULL,
JSON LONGTEXT NOT NULL,
CONSTRAINT MYBAAS_PK PRIMARY KEY (ID) WITH (IGNORE_DUP_KEY=ON)
);

CREATE TABLE IF NOT EXISTS PROPERTY_MAP (
ID VARCHAR(64) NOT NULL,
PROPERTY_NAME VARCHAR(64) NOT NULL,
COLUMN_NAME VARCHAR(64) NOT NULL,
TYPE_NAME VARCHAR(64) NOT NULL,
CONSTRAINT PROPERTY_MAP_PK PRIMARY KEY (ID)
);

CREATE UNIQUE INDEX PROPERTY_MAP_UK01
ON PROPERTY_MAP(PROPERTY_NAME) WITH (IGNORE_DUP_KEY = ON);

CREATE UNIQUE INDEX PROPERTY_MAP_UK02
ON PROPERTY_MAP(COLUMN_NAME) WITH (IGNORE_DUP_KEY = ON);
+ +

SQLite

+
1
2
INSERT OR REPLACE INTO MYBAAS(ID, TYPE_NAME, JSON)
VALUES(?, ?, ?);
+ +

MariaDB/MySQL

+
1
2
3
INSERT INTO MYBAAS(ID, TYPE_NAME, JSON)
VALUES(?, ?, ?)
ON DUPLICATE KEY UPDATE TYPE_NAME=?, JSON=?
+ +

Oracle

+
1
2
3
4
5
6
7
8
MERGE INTO MYBAAS D
USING (SELECT ? AS ID, ? AS TYPE_NAME, ? AS JSON FROM DUAL) S
ON (D.ID = S.ID)
WHEN MATCHED THEN
UPDATE SET D.TYPE_NAME = S.TYPE_NAME
WHEN NOT MATCHED THEN
INSERT (D.ID, D.TYPE_NAME, D.JSON)
VALUES (S.ID, S.TYPE_NAME, S.JSON);
+ +

DB2

1
2
3
4
5
6
7
MERGE INTO MYBAAS AS D
USING (VALUES(?, ?, ?)) AS S(ID, TYPE_NAME, JSON)
ON D.ID = S.ID
WHEN MATCHED THEN
UPDATE SET D.TYPE_NAME = S.TYPE_NAME, D.JSON = S.JSON
WHEN NOT MATCHED THEN
INSERT (ID, TYPE_NAME, JSON) VALUES (S.ID, S.TYPE_NAME, S.JSON);
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/01/11/java-offset-datetime-formatter/index.html b/2020/01/11/java-offset-datetime-formatter/index.html new file mode 100644 index 00000000..78b8508a --- /dev/null +++ b/2020/01/11/java-offset-datetime-formatter/index.html @@ -0,0 +1,189 @@ + + + + + + + + + + + + Java Offset DateTime Formatter | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Java Offset DateTime Formatter +

+ +

Java Offset DateTime Formatter

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import java.time.Instant;
import java.time.OffsetDateTime;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;

public final class Bootstrap {
public static void main(String[] argv) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
Instant now = Instant.now();
List<OffsetDateTime> dts = new ArrayList<>(3);

OffsetDateTime current = OffsetDateTime.ofInstant(now, ZoneId.systemDefault());
dts.add(current);

current = OffsetDateTime.ofInstant(now, ZoneId.ofOffset("UTC", ZoneOffset.ofHours(5)));
dts.add(current);

current = OffsetDateTime.ofInstant(now, ZoneId.ofOffset("UTC", ZoneOffset.ofHours(0)));
dts.add(current);

for (OffsetDateTime dt : dts) {
String str = formatter.format(dt);
System.out.println(str);
}
}
}
+ +
1
2
3
2020-01-11T13:05:21.621+0800
2020-01-11T10:05:21.621+0500
2020-01-11T05:05:21.621+0000
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/01/12/how-to-flush-output-of-python-print-function/index.html b/2020/01/12/how-to-flush-output-of-python-print-function/index.html new file mode 100644 index 00000000..f8447506 --- /dev/null +++ b/2020/01/12/how-to-flush-output-of-python-print-function/index.html @@ -0,0 +1,191 @@ + + + + + + + + + + + + How to flush output of Python print function | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ How to flush output of Python print function +

+ +

How to flush output of Python print function

take an optional flush argument

1
print("Hello world!", flush=True)
+ +

overwrite print function with default set to flush = True

1
2
def print(*objects, sep=' ', end='\n', file=sys.stdout, flush=True):
__builtins__.print(*objects, sep=sep, end=end, file=file, flush=flush)
+ +

lambda function

1
2
message = lambda x: print(x, flush=True, end="")
message('I am flushing out now...')
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/01/18/list-and-install-vscode-extensions/index.html b/2020/01/18/list-and-install-vscode-extensions/index.html new file mode 100644 index 00000000..3141e3a8 --- /dev/null +++ b/2020/01/18/list-and-install-vscode-extensions/index.html @@ -0,0 +1,191 @@ + + + + + + + + + + + + List and Install VSCode Extensions | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ List and Install VSCode Extensions +

+ +

List and Install VSCode Extensions

List Extensions

1
code --list-extensions
+ +

Install Extensions - bash

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
code --list-extensions | LC_COLLATE=en_US sort | xargs -n 1 echo code --install-extension

code --install-extension aaron-bond.better-comments
code --install-extension ahebrank.yaml2json
code --install-extension AlanWalk.markdown-toc
code --install-extension alefragnani.Bookmarks
code --install-extension austin.code-gnu-global
code --install-extension bat67.markdown-extension-pack
code --install-extension bierner.markdown-emoji
code --install-extension brendandburns.vs-kubernetes
code --install-extension buianhthang.xml2json
code --install-extension christian-kohler.npm-intellisense
code --install-extension ckolkman.vscode-postgres
code --install-extension CoenraadS.bracket-pair-colorizer
code --install-extension darkriszty.markdown-table-prettify
code --install-extension DavidAnson.vscode-markdownlint
code --install-extension dbaeumer.vscode-eslint
code --install-extension dgileadi.java-decompiler
code --install-extension donjayamanne.githistory
code --install-extension DotJoshJohnson.xml
code --install-extension eamodio.gitlens
code --install-extension ecmel.vscode-html-css
code --install-extension ecmel.vscode-spring-boot
code --install-extension EditorConfig.EditorConfig
code --install-extension eriklynd.json-tools
code --install-extension esbenp.prettier-vscode
code --install-extension felipecaputo.git-project-manager
code --install-extension firefox-devtools.vscode-firefox-debug
code --install-extension formulahendry.code-runner
code --install-extension formulahendry.terminal
code --install-extension formulahendry.vscode-mysql
code --install-extension goessner.mdmath
code --install-extension gurayyarar.editorenhancements
code --install-extension henoc.svgeditor
code --install-extension hollowtree.vue-snippets
code --install-extension HookyQR.beautify
code --install-extension humao.rest-client
code --install-extension ipedrazas.kubernetes-snippets
code --install-extension James-Yu.latex-workshop
code --install-extension jebbs.plantuml
code --install-extension kalitaalexey.vscode-rust
code --install-extension lextudio.restructuredtext
code --install-extension mariorodeghiero.vue-theme
code --install-extension michelemelluso.code-beautifier
code --install-extension mohsen1.prettify-json
code --install-extension ms-azuretools.vscode-docker
code --install-extension msjsdiag.debugger-for-chrome
code --install-extension msjsdiag.vscode-react-native
code --install-extension ms-kubernetes-tools.vscode-kubernetes-tools
code --install-extension ms-mssql.mssql
code --install-extension ms-python.python
code --install-extension ms-vscode.cpptools
code --install-extension ms-vscode.csharp
code --install-extension ms-vscode.Go
code --install-extension ms-vscode.powershell
code --install-extension ms-vscode-remote.remote-ssh-edit
code --install-extension ms-vscode-remote.remote-wsl
code --install-extension ms-vsliveshare.vsliveshare
code --install-extension nickdemayo.vscode-json-editor
code --install-extension octref.vetur
code --install-extension Pivotal.vscode-boot-dev-pack
code --install-extension Pivotal.vscode-concourse
code --install-extension Pivotal.vscode-manifest-yaml
code --install-extension Pivotal.vscode-spring-boot
code --install-extension pkosta2006.rxjs-snippets
code --install-extension quillaja.goasm
code --install-extension redhat.java
code --install-extension redhat.vscode-xml
code --install-extension redhat.vscode-yaml
code --install-extension rust-lang.rust
code --install-extension sdras.night-owl
code --install-extension sdras.vue-vscode-extensionpack
code --install-extension sdras.vue-vscode-snippets
code --install-extension shanoor.vscode-nginx
code --install-extension shd101wyy.markdown-preview-enhanced
code --install-extension tombonnike.vscode-status-bar-format-toggle
code --install-extension VisualStudioExptTeam.vscodeintellicode
code --install-extension vscjava.vscode-java-debug
code --install-extension vscjava.vscode-java-dependency
code --install-extension vscjava.vscode-java-pack
code --install-extension vscjava.vscode-java-test
code --install-extension vscjava.vscode-maven
code --install-extension vscjava.vscode-spring-boot-dashboard
code --install-extension vscjava.vscode-spring-initializr
code --install-extension wmaurer.vscode-jumpy
code --install-extension xabikos.JavaScriptSnippets
code --install-extension yzane.markdown-pdf
code --install-extension yzhang.markdown-all-in-one
code --install-extension ZakCodes.rust-snippets
+ +

Install Extensions - PowerShell

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
code --list-extensions | sort | % { "code --install-extension $_" }

code --install-extension aaron-bond.better-comments
code --install-extension ahebrank.yaml2json
code --install-extension AlanWalk.markdown-toc
code --install-extension alefragnani.Bookmarks
code --install-extension austin.code-gnu-global
code --install-extension bat67.markdown-extension-pack
code --install-extension bierner.markdown-emoji
code --install-extension brendandburns.vs-kubernetes
code --install-extension buianhthang.xml2json
code --install-extension christian-kohler.npm-intellisense
code --install-extension ckolkman.vscode-postgres
code --install-extension CoenraadS.bracket-pair-colorizer
code --install-extension darkriszty.markdown-table-prettify
code --install-extension DavidAnson.vscode-markdownlint
code --install-extension dbaeumer.vscode-eslint
code --install-extension dgileadi.java-decompiler
code --install-extension donjayamanne.githistory
code --install-extension DotJoshJohnson.xml
code --install-extension eamodio.gitlens
code --install-extension ecmel.vscode-html-css
code --install-extension ecmel.vscode-spring-boot
code --install-extension EditorConfig.EditorConfig
code --install-extension eriklynd.json-tools
code --install-extension esbenp.prettier-vscode
code --install-extension felipecaputo.git-project-manager
code --install-extension firefox-devtools.vscode-firefox-debug
code --install-extension formulahendry.code-runner
code --install-extension formulahendry.terminal
code --install-extension formulahendry.vscode-mysql
code --install-extension goessner.mdmath
code --install-extension gurayyarar.editorenhancements
code --install-extension henoc.svgeditor
code --install-extension hollowtree.vue-snippets
code --install-extension HookyQR.beautify
code --install-extension humao.rest-client
code --install-extension ipedrazas.kubernetes-snippets
code --install-extension James-Yu.latex-workshop
code --install-extension jebbs.plantuml
code --install-extension kalitaalexey.vscode-rust
code --install-extension lextudio.restructuredtext
code --install-extension mariorodeghiero.vue-theme
code --install-extension michelemelluso.code-beautifier
code --install-extension mohsen1.prettify-json
code --install-extension ms-azuretools.vscode-docker
code --install-extension msjsdiag.debugger-for-chrome
code --install-extension msjsdiag.vscode-react-native
code --install-extension ms-kubernetes-tools.vscode-kubernetes-tools
code --install-extension ms-mssql.mssql
code --install-extension ms-python.python
code --install-extension ms-vscode.cpptools
code --install-extension ms-vscode.csharp
code --install-extension ms-vscode.Go
code --install-extension ms-vscode.powershell
code --install-extension ms-vscode-remote.remote-ssh-edit
code --install-extension ms-vscode-remote.remote-wsl
code --install-extension ms-vsliveshare.vsliveshare
code --install-extension nickdemayo.vscode-json-editor
code --install-extension octref.vetur
code --install-extension Pivotal.vscode-boot-dev-pack
code --install-extension Pivotal.vscode-concourse
code --install-extension Pivotal.vscode-manifest-yaml
code --install-extension Pivotal.vscode-spring-boot
code --install-extension pkosta2006.rxjs-snippets
code --install-extension quillaja.goasm
code --install-extension redhat.java
code --install-extension redhat.vscode-xml
code --install-extension redhat.vscode-yaml
code --install-extension rust-lang.rust
code --install-extension sdras.night-owl
code --install-extension sdras.vue-vscode-extensionpack
code --install-extension sdras.vue-vscode-snippets
code --install-extension shanoor.vscode-nginx
code --install-extension shd101wyy.markdown-preview-enhanced
code --install-extension tombonnike.vscode-status-bar-format-toggle
code --install-extension VisualStudioExptTeam.vscodeintellicode
code --install-extension vscjava.vscode-java-debug
code --install-extension vscjava.vscode-java-dependency
code --install-extension vscjava.vscode-java-pack
code --install-extension vscjava.vscode-java-test
code --install-extension vscjava.vscode-maven
code --install-extension vscjava.vscode-spring-boot-dashboard
code --install-extension vscjava.vscode-spring-initializr
code --install-extension wmaurer.vscode-jumpy
code --install-extension xabikos.JavaScriptSnippets
code --install-extension yzane.markdown-pdf
code --install-extension yzhang.markdown-all-in-one
code --install-extension ZakCodes.rust-snippets
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/01/24/rxjava-3/index.html b/2020/01/24/rxjava-3/index.html new file mode 100644 index 00000000..6c69f19b --- /dev/null +++ b/2020/01/24/rxjava-3/index.html @@ -0,0 +1,238 @@ + + + + + + + + + + + + RxJava 3 | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ RxJava 3 +

+ +

RxJava 3

RxJava 3 components now live under io.reactivex.rxjava3 and the base classes and interfaces live under io.reactivex.rxjava3.core

+
    +
  • single dependency: Reactive-Streams
  • +
  • Java 8+ (Android desugar friendly)
  • +
  • Java 8 lambda-friendly API
  • +
  • fixed API mistakes and many limits of RxJava 2
  • +
  • intended to be a replacement for RxJava 2 with relatively few binary incompatible changes
  • +
  • non-opinionated about the source of concurrency (threads, pools, event loops, fibers, actors, etc.)
  • +
  • async or synchronous execution
  • +
  • virtual time and schedulers for parameterized concurrency
  • +
  • test and diagnostic support via test schedulers, test consumers and plugin hooks
  • +
+

Base classes

RxJava 3 features several base classes you can discover operators on:

+ +

Dataflows

The dataflows in RxJava consist of a source, zero or more intermediate steps followed by a data consumer or combinator step (where the step is responsible to consume the dataflow by some means):

+
1
2
3
source.operator1().operator2().operator3().subscribe(consumer);

source.flatMap(value -> source.operator1().operator2().operator3());
+ +

Backpressure

When the dataflow runs through asynchronous steps, each step may perform different things with different speed. To avoid overwhelming such steps, which usually would manifest itself as increased memory usage due to temporary buffering or the need for skipping/dropping data, so-called backpressure is applied, which is a form of flow control where the steps can express how many items are they ready to process. This allows constraining the memory usage of the dataflows in situations where there is generally no way for a step to know how many items the upstream will send to it.

+

In RxJava, the dedicated Flowable class is designated to support backpressure and Observable is dedicated to the non-backpressured operations (short sequences, GUI interactions, etc.). The other types, Single, Maybe and Completable don’t support backpressure nor should they; there is always room to store one item temporarily.

+

Simple background computation

One of the common use cases for RxJava is to run some computation, network request on a background thread and show the results (or error) on the UI thread:

+
1
2
3
4
5
6
7
8
9
10
11
import io.reactivex.rxjava3.schedulers.Schedulers;

Flowable.fromCallable(() -> {
Thread.sleep(1000); // imitate expensive computation
return "Done";
})
.subscribeOn(Schedulers.io())
.observeOn(Schedulers.single())
.subscribe(System.out::println, Throwable::printStackTrace);

Thread.sleep(2000); // <--- wait for the flow to finish
+ +

This style of chaining methods is called a fluent API which resembles the builder pattern. However, RxJava’s reactive types are immutable; each of the method calls returns a new Flowable with added behavior. To illustrate, the example can be rewritten as follows:

+
1
2
3
4
5
6
7
8
9
10
11
12
Flowable<String> source = Flowable.fromCallable(() -> {
Thread.sleep(1000); // imitate expensive computation
return "Done";
});

Flowable<String> runBackground = source.subscribeOn(Schedulers.io());

Flowable<String> showForeground = runBackground.observeOn(Schedulers.single());

showForeground.subscribe(System.out::println, Throwable::printStackTrace);

Thread.sleep(2000);
+ +

Typically, you can move computations or blocking IO to some other thread via subscribeOn. Once the data is ready, you can make sure they get processed on the foreground or GUI thread via observeOn.

+

Schedulers

RxJava operators don’t work with Threads or ExecutorServices directly but with so-called Schedulers that abstract away sources of concurrency behind a uniform API. RxJava 3 features several standard schedulers accessible via Schedulers utility class.

+
    +
  • Schedulers.computation(): Run computation intensive work on a fixed number of dedicated threads in the background. Most asynchronous operators use this as their default Scheduler.
  • +
  • Schedulers.io(): Run I/O-like or blocking operations on a dynamically changing set of threads.
  • +
  • Schedulers.single(): Run work on a single thread in a sequential and FIFO manner.
  • +
  • Schedulers.trampoline(): Run work in a sequential and FIFO manner in one of the participating threads, usually for testing purposes.
  • +
+

These are available on all JVM platforms but some specific platforms, such as Android, have their own typical Schedulers defined: AndroidSchedulers.mainThread(), SwingScheduler.instance() or JavaFXSchedulers.gui().

+

In addition, there is an option to wrap an existing Executor (and its subtypes such as ExecutorService) into a Scheduler via Schedulers.from(Executor). This can be used, for example, to have a larger but still fixed pool of threads (unlike computation() and io() respectively).

+

Parallel processing

1
2
3
4
5
6
Flowable.range(1, 10)
.parallel()
.runOn(Schedulers.computation())
.map(v -> v * v)
.sequential()
.blockingSubscribe(System.out::println);
+ +

Continuations

Sometimes, when an item has become available, one would like to perform some dependent computations on it. This is sometimes called continuations and, depending on what should happen and what types are involved, may involve various operators to accomplish.

+

Dependent

The most typical scenario is to given a value, invoke another service, await and continue with its result:

+
1
2
3
service.apiCall()
.flatMap(value -> service.anotherApiCall(value))
.flatMap(next -> service.finalCall(next))
+ +

Non-dependent

In other scenarios, the result(s) of the first source/dataflow is irrelevant and one would like to continue with a quasi independent another source. Here, flatMap works as well:

+
1
2
3
Observable continued = sourceObservable.flatMapSingle(ignored -> someSingleSource)
continued.map(v -> v.toString())
.subscribe(System.out::println, Throwable::printStackTrace);
+ +

Deferred-dependent

Sometimes, there is an implicit data dependency between the previous sequence and the new sequence that, for some reason, was not flowing through the “regular channels”.

+
1
2
3
4
5
6
AtomicInteger count = new AtomicInteger();
Observable.range(1, 10)
.doOnNext(ignored -> count.incrementAndGet())
.ignoreElements()
.andThen(Single.defer(() -> Single.just(count.get())))
.subscribe(System.out::println);
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/01/25/pg-metrics/index.html b/2020/01/25/pg-metrics/index.html new file mode 100644 index 00000000..6927cbb2 --- /dev/null +++ b/2020/01/25/pg-metrics/index.html @@ -0,0 +1,203 @@ + + + + + + + + + + + + pg metrics | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ pg metrics +

+ +

pgmetrics

+

pgmetrics is an open-source, zero-dependency, single-binary tool that can collect a lot of information and statistics from a running PostgreSQL server and display it in easy-to-read text format or export it as JSON and CSV for scripting.

+
    +
  • Subsystem Info
  • +
  • Database Info
  • +
  • Table Info
  • +
  • Log Files
  • +
  • Easy-to-use CLI
  • +
  • Zero Dependency
  • +
+

Sample output

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
pgmetrics run at: 20 Dec 2019 6:41:13 AM (now)

PostgreSQL Cluster:
Name: 10/main
Server Version: 10.10
Server Started: 20 Dec 2019 6:32:35 AM (8 minutes ago)
System Identifier: 6772342791073124390
Timeline: 1
Last Checkpoint: 20 Dec 2019 6:32:15 AM (8 minutes ago)
Prior LSN: 0/1692308
REDO LSN: 0/16923B0 (168 B since Prior)
Checkpoint LSN: 0/16923B0 (0 B since REDO)
Transaction IDs: 548 to 563 (diff = 15)
Notification Queue: 0.0% used
Active Backends: 1 (max 1000)
Recovery Mode? no

WAL Files:
WAL Archiving? no
+--------------------+---------------+
| Setting | Value |
+--------------------+---------------+
| wal_level | logical |
| archive_timeout | 0 |
| wal_compression | on |
| max_wal_size | 2048 (32 GiB) |
| min_wal_size | 64 (1.0 GiB) |
| checkpoint_timeout | 600 |
| full_page_writes | on |
| wal_keep_segments | 8 |
+--------------------+---------------+

BG Writer:
Checkpoint Rate: 0.12 per min
Average Write: 8.8 KiB per checkpoint
Total Checkpoints: 24 sched (80.0%) + 6 req (20.0%) = 30
Total Write: 264 KiB, @ 17 B per sec
Buffers Allocated: 651 (5.1 MiB)
Buffers Written: 33 chkpt (100.0%) + 0 bgw (0.0%) + 0 be (0.0%)
Clean Scan Stops: 0
BE fsyncs: 0
Counts Since: 20 Dec 2019 2:28:52 AM (4 hours ago)
+------------------------------+--------------+
| Setting | Value |
+------------------------------+--------------+
| bgwriter_delay | 200 msec |
| bgwriter_flush_after | 64 (512 KiB) |
| bgwriter_lru_maxpages | 100 |
| bgwriter_lru_multiplier | 2 |
| block_size | 8192 |
| checkpoint_timeout | 600 sec |
| checkpoint_completion_target | 0.96 |
+------------------------------+--------------+

Backends:
Total Backends: 1 (0.1% of max 1000)
Problematic: 0 waiting on locks, 0 waiting on other, 0 xact too long, 0 idle in xact

Locks:
+------------+-------------+-------+
| Lock Type | Not Granted | Total |
+------------+-------------+-------+
| relation | 0 | 4 |
| virtualxid | 0 | 1 |
+------------+-------------+-------+
| | 0 | 5 |
+------------+-------------+-------+

Vacuum Progress:
No manual or auto vacuum jobs in progress.
+------------------------------+----------------+
| Setting | Value |
+------------------------------+----------------+
| maintenance_work_mem | 65536 (64 MiB) |
| autovacuum | on |
| autovacuum_analyze_threshold | 50 |
| autovacuum_vacuum_threshold | 50 |
| autovacuum_freeze_max_age | 200000000 |
| autovacuum_max_workers | 3 |
| autovacuum_naptime | 60 sec |
| vacuum_freeze_min_age | 50000000 |
| vacuum_freeze_table_age | 150000000 |
+------------------------------+----------------+

Roles:
+----------------------+-------+------+-------+-----------+----------+------------+---------+---------+--------------------------------------------------------------+
| Name | Login | Repl | Super | Creat Rol | Creat DB | Bypass RLS | Inherit | Expires | Member Of |
+----------------------+-------+------+-------+-----------+----------+------------+---------+---------+--------------------------------------------------------------+
| postgres | yes | yes | yes | yes | yes | yes | yes | | |
| pg_monitor | | | | | | | yes | | pg_read_all_settings, pg_read_all_stats, pg_stat_scan_tables |
| pg_read_all_settings | | | | | | | yes | | |
| pg_read_all_stats | | | | | | | yes | | |
| pg_stat_scan_tables | | | | | | | yes | | |
| pg_signal_backend | | | | | | | yes | | |
| collector | yes | | | | | | yes | | |
| replicator | yes | | | | | | yes | | |
| idg | yes | | | | | | yes | | |
+----------------------+-------+------+-------+-----------+----------+------------+---------+---------+--------------------------------------------------------------+

Tablespaces:
+------------+----------+----------+--------+
| Name | Owner | Location | Size |
+------------+----------+----------+--------+
| pg_default | postgres | | 45 MiB |
| pg_global | postgres | | |
+------------+----------+----------+--------+

Database #1:
Name: postgres
Owner: postgres
Tablespace: pg_default
Connections: 0 (no max limit)
Frozen Xid Age: 16
Transactions: 2014 (100.0%) commits, 0 (0.0%) rollbacks
Cache Hits: 99.6%
Rows Changed: ins 0.0%, upd 0.0%, del 0.0%
Total Temp: 0 B in 0 files
Problems: 0 deadlocks, 0 conflicts
Totals Since: 20 Dec 2019 2:28:53 AM (4 hours ago)
Size: 7.6 MiB

Database #2:
Name: collector
Owner: collector
Tablespace: pg_default
Connections: 0 (no max limit)
Frozen Xid Age: 16
Transactions: 0 (0.0%) commits, 0 (0.0%) rollbacks
Cache Hits: 0.0%
Rows Changed: ins 0.0%, upd 0.0%, del 0.0%
Total Temp: 0 B in 0 files
Problems: 0 deadlocks, 0 conflicts
Totals Since:
Size: 7.5 MiB

Database #3:
Name: replicator
Owner: replicator
Tablespace: pg_default
Connections: 0 (no max limit)
Frozen Xid Age: 16
Transactions: 0 (0.0%) commits, 0 (0.0%) rollbacks
Cache Hits: 0.0%
Rows Changed: ins 0.0%, upd 0.0%, del 0.0%
Total Temp: 0 B in 0 files
Problems: 0 deadlocks, 0 conflicts
Totals Since:
Size: 7.5 MiB

Database #4:
Name: idg
Owner: idg
Tablespace: pg_default
Connections: 1 (no max limit)
Frozen Xid Age: 16
Transactions: 604 (98.1%) commits, 12 (1.9%) rollbacks
Cache Hits: 98.4%
Rows Changed: ins 92.0%, upd 8.0%, del 0.0%
Total Temp: 0 B in 0 files
Problems: 0 deadlocks, 0 conflicts
Totals Since: 20 Dec 2019 2:28:54 AM (4 hours ago)
Size: 7.7 MiB
Installed Extensions:
+---------+---------+------------------------------+
| Name | Version | Comment |
+---------+---------+------------------------------+
| plpgsql | 1.0 | PL/pgSQL procedural language |
+---------+---------+------------------------------+

Table #1 in "idg":
Name: idg.public.idg_state
Columns: 3
Manual Vacuums: never
Manual Analyze: never
Auto Vacuums: never
Auto Analyze: never
Post-Analyze: 0.0% est. rows modified
Row Estimate: 0.0% live of total 0
Rows Changed: ins 0.0%, upd 0.0%, del 0.0%
HOT Updates: 0.0% of all updates
Seq Scans: 1, 0.0 rows/scan
Idx Scans: 0, 0.0 rows/scan
Cache Hits: 0.0% (idx=0.0%)
Size: 0 B
+----------------+-------+---------+-------+------------+-------+----------------+-------------------+
| Index | Type | Size | Bloat | Cache Hits | Scans | Rows Read/Scan | Rows Fetched/Scan |
+----------------+-------+---------+-------+------------+-------+----------------+-------------------+
| idg_state_pkey | btree | 8.0 KiB | | | 0 | 0.0 | 0.0 |
+----------------+-------+---------+-------+------------+-------+----------------+-------------------+
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/01/26/linux-desktop-entry/index.html b/2020/01/26/linux-desktop-entry/index.html new file mode 100644 index 00000000..43e8270b --- /dev/null +++ b/2020/01/26/linux-desktop-entry/index.html @@ -0,0 +1,191 @@ + + + + + + + + + + + + Linux Desktop Entry | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Linux Desktop Entry +

+ +

Linux Desktop Entry

Desktop entry location

1
2
3
4
${HOME}/.config/autostart/google-chrome.desktop
${HOME}/.local/share/applications/jetbrains-idea.desktop
/usr/share/applications/google-chrome.desktop
/usr/share/applications/firefox-esr.desktop
+ +

Google Chrome

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
[Desktop Entry]
Type=Application
Name=Google Chrome
GenericName=Web Browser
Comment=Access the Internet
Exec=/usr/bin/google-chrome-stable %U
StartupNotify=true
Terminal=false
Icon=google-chrome
Categories=Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml_xml;image/webp;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/ftp;
Actions=new-window;new-private-window;

[Desktop Action new-window]
Name=New Window
Exec=/usr/bin/google-chrome-stable

[Desktop Action new-private-window]
Name=New Incognito Window
Exec=/usr/bin/google-chrome-stable --incognito
+ +

Mozilla Firefox ESR

1
2
3
4
5
6
7
8
9
10
11
[Desktop Entry]
Type=Application
Name=Firefox ESR
GenericName=Web Browser
Comment=Browse the World Wide Web
Exec=/usr/lib/firefox-esr/firefox-esr %u
StartupNotify=true
Terminal=false
Icon=firefox-esr
Categories=Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/vnd.mozilla.xul+xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https;
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/01/27/rust-installation/index.html b/2020/01/27/rust-installation/index.html new file mode 100644 index 00000000..34ce3253 --- /dev/null +++ b/2020/01/27/rust-installation/index.html @@ -0,0 +1,239 @@ + + + + + + + + + + + + Rust installation | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Rust installation +

+ +

Install Rust

Rust’s core design principles

    +
  • Practicality — it should be a language that can be and is used in the real world.
  • +
  • Pragmatism — it should admit concessions to human usability and integration into systems as they exist today.
  • +
  • Memory-safety — it must enforce memory safety, and not admit segmentation faults and other such memory-access violations.
  • +
  • Performance — it must be in the same performance class as C++. favored run-time over compile-time.
  • +
  • Concurrency — it must provide modern solutions to writing concurrent code.
  • +
+

Release channels and riding the trains

Rust development operates on a train schedule. That is, all development is +done on the master branch of the Rust repository. Releases follow a software +release train model, which has been used by Cisco IOS and other software +projects. There are three release channels for Rust:

+
    +
  • Nightly
  • +
  • Beta
  • +
  • Stable
  • +
+

Every six weeks, it’s time to prepare a new release! The beta branch of the +Rust repository branches off from the master branch used by nightly.

+

Six weeks after the first beta was created, it’s time for a stable release! +The stable branch is produced from the beta branch.

+

This is called the “train model” because every six weeks, a release “leaves +the station”.

+

Rust stable channel

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
curl -sSLO https://static.rust-lang.org/dist/channel-rust-stable.toml.sha256
curl -sSLO https://static.rust-lang.org/dist/channel-rust-stable.toml

$ cat channel-rust-stable.toml | grep x86_64-unknown-linux-gnu.tar.xz | awk -F '"' '{print $2}'
$ cat channel-rust-stable.toml | grep x86_64-pc-windows-msvc.tar.xz | awk -F '"' '{print $2}'

while read triple rest; do
[ -z "$triple" ] || cat channel-rust-stable.toml | grep $triple.tar.xz | awk -F '"' '{print $2}' | grep rustc-1
done << EOF
aarch64-unknown-linux-gnu
armv7-unknown-linux-gnueabihf
riscv64gc-unknown-linux-gnu
s390x-unknown-linux-gnu
x86_64-pc-windows-gnu
x86_64-unknown-linux-gnu
x86_64-unknown-linux-musl

aarch64-apple-ios
aarch64-linux-android
mips64el-unknown-linux-gnuabi64
x86_64-apple-darwin
x86_64-pc-windows-msvc
x86_64-unknown-freebsd
x86_64-unknown-netbsd
EOF

https://static.rust-lang.org/dist/2020-03-12/rustc-1.42.0-aarch64-unknown-linux-gnu.tar.xz
https://static.rust-lang.org/dist/2020-03-12/rustc-1.42.0-armv7-unknown-linux-gnueabihf.tar.xz
https://static.rust-lang.org/dist/2020-03-12/rustc-1.42.0-mips64el-unknown-linux-gnuabi64.tar.xz
https://static.rust-lang.org/dist/2020-03-12/rustc-1.42.0-s390x-unknown-linux-gnu.tar.xz
https://static.rust-lang.org/dist/2020-03-12/rustc-1.42.0-x86_64-apple-darwin.tar.xz
https://static.rust-lang.org/dist/2020-03-12/rustc-1.42.0-x86_64-pc-windows-gnu.tar.xz
https://static.rust-lang.org/dist/2020-03-12/rustc-1.42.0-x86_64-pc-windows-msvc.tar.xz
https://static.rust-lang.org/dist/2020-03-12/rustc-1.42.0-x86_64-unknown-freebsd.tar.xz
https://static.rust-lang.org/dist/2020-03-12/rustc-1.42.0-x86_64-unknown-linux-gnu.tar.xz
https://static.rust-lang.org/dist/2020-03-12/rustc-1.42.0-x86_64-unknown-linux-musl.tar.xz
https://static.rust-lang.org/dist/2020-03-12/rustc-1.42.0-x86_64-unknown-netbsd.tar.xz
+ +

Using rustup

Linux user

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
| sh -s -- --profile minimal --default-toolchain nightly

# export CARGO_HTTP_PROXY="socks5h://proxy.example.com"
# export CARGO_HOME=/opt/rust
# export CARGO_HTTP_MULTIPLEXING=true

$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

$ cargo install cargo-binutils
$ rustup component add llvm-tools-preview
$ cargo objdump -- -version
$ cargo nm --bin app --release
$ cargo nm --bin app --release -- -print-size -size-sort
$ cargo objdump --bin app --release -- -disassemble -no-show-raw-insn
$ cargo size --bin app --release -- -A -x
+ +

Windows user

Windows builds of rustup additionally require an installation of Visual +Studio 2019 or the Visual C++ Build Tools 2019. For Visual Studio, make +sure to check the “C++ tools” and “Windows 10 SDK” option

+
1
2
curl -sSL -o rustup-init.exe https://win.rustup.rs/
rustup-init.exe
+ +

Update

1
2
rustup self update
rustup update
+ +

Verify

1
2
cargo --version
rustc --version
+ +

Generating a new project

1
2
3
cargo new hello-rust
cd hello-rust/
cargo run
+ +

Working with nightly Rust

1
2
3
4
5
6
rustup toolchain install nightly
rustup run nightly rustc --version

cargo new hello-rust
cd hello-rust/
cargo +nightly run
+ +

Cross-compilation

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
sudo apt-get install -y \
g++ \
g++-aarch64-linux-gnu \
g++-arm-linux-gnueabi \
g++-mingw-w64-x86-64-posix \
g++-riscv64-linux-gnu \
g++-s390x-linux-gnu \
musl-tools \
opensbi \
ovmf \
qemu-efi-aarch64 \
qemu-efi-arm \
qemu-system-arm \
qemu-system-misc \
u-boot-qemu

# https://developer.arm.com/ip-products/processors/cortex-a [a7, a9, a15, a72]
# https://developer.arm.com/ip-products/processors/cortex-r [r5, r5f]
# https://developer.arm.com/ip-products/processors/cortex-m [m3/thumbv7m-none-eabi, m4/thumbv7em-none-eabi]
# https://en.wikipedia.org/wiki/Comparison_of_ARMv7-A_cores
# https://en.wikipedia.org/wiki/Comparison_of_ARMv8-A_cores
# https://en.wikipedia.org/wiki/RISC-V
# https://docs.rust-embedded.org/faq.html

rustup target add \
aarch64-unknown-linux-gnu \
armv7-unknown-linux-gnueabihf \
riscv64gc-unknown-linux-gnu \
s390x-unknown-linux-gnu \
x86_64-pc-windows-gnu \
x86_64-unknown-linux-gnu \
x86_64-unknown-linux-musl

rustup target list

rustc \
--target=riscv64gc-unknown-linux-gnu \
-C linker=riscv64-linux-gnu-gcc \
main.rs

cat > ~/.cargo/config << EOF
[target.aarch64-unknown-linux-gnu]
linker = "aarch64-linux-gnu-gcc"

[target.riscv64gc-unknown-linux-gnu]
linker = "riscv64-linux-gnu-gcc"

[target.s390x-unknown-linux-gnu]
linker = "s390x-linux-gnu-gcc"

[target.x86_64-pc-windows-gnu]
linker = "x86_64-w64-mingw32-gcc"

[target.x86_64-unknown-linux-gnu]
linker = "x86_64-linux-gnu-gcc"

[target.x86_64-unknown-linux-musl]
linker = "musl-gcc"

# Cortex-A7, A9, A15
[target.armv7-unknown-linux-gnueabihf]
linker = "arm-linux-gnueabihf-gcc"

# Cortex-M3
[target.thumbv7m-none-eabi]
linker = "arm-linux-gnueabi-gcc"

# Cortex-M4 and Cortex-M7
[target.thumbv7em-none-eabi]
linker = "arm-linux-gnueabi-gcc"

# Cortex-R4 and Cortex-R5
[target.armv7r-none-eabi]
linker = "arm-linux-gnueabi-gcc"

# RV32I base instruction set with M, A and C extensions
# XuanTie 902 (RV32EMC)
# XuanTie 910 (RV64GCV)
[target.riscv32imac-unknown-none-elf]
linker = "riscv32imac-none-gcc"
EOF

cargo build --target=aarch64-unknown-linux-gnu
cargo build --target=armv7-unknown-linux-gnueabihf
cargo build --target=riscv64gc-unknown-linux-gnu
cargo build --target=s390x-unknown-linux-gnu
cargo build --target=x86_64-pc-windows-gnu
cargo build --target=x86_64-unknown-linux-gnu
cargo build --target=x86_64-unknown-linux-musl
+ +

Environment variables

    +
  • RUSTUP_HOME (default: ~/.rustup or %USERPROFILE%/.rustup) Sets the root rustup folder, used for storing installed toolchains and configuration options.
  • +
  • RUSTUP_TOOLCHAIN (default: none) If set, will override the toolchain used for all rust tool invocations. A toolchain with this name should be installed, or invocations will fail.
  • +
  • RUSTUP_DIST_SERVER (default: https://static.rust-lang.org) Sets the root URL for downloading static resources related to Rust. You can change this to instead use a local mirror, or to test the binaries from the staging directory.
  • +
  • RUSTUP_DIST_ROOT (default: https://static.rust-lang.org/dist) Deprecated. Use RUSTUP_DIST_SERVER instead.
  • +
  • RUSTUP_UPDATE_ROOT (default https://static.rust-lang.org/rustup) Sets the root URL for downloading self-updates.
  • +
  • RUSTUP_IO_THREADS unstable (defaults to reported cpu count). Sets the number of threads to perform close IO in. Set to disabled to force single-threaded IO for troubleshooting, or an arbitrary number to override automatic detection.
  • +
  • RUSTUP_TRACE_DIR unstable (default: no tracing) Enables tracing and determines the directory that traces will be written too. Traces are of the form PID.trace. Traces can be read by the Catapult project tracing viewer.
  • +
  • RUSTUP_UNPACK_RAM unstable (default 400M, min 100M) Caps the amount of RAM rustup will use for IO tasks while unpacking.
  • +
  • RUSTUP_NO_BACKTRACE Disables backtraces on non-panic errors even when RUST_BACKTRACE is set.
  • +
+

Working with network proxies

1
2
export https_proxy=socks5://proxy.example.com:1080
export https_proxy=http://proxy.example.com:8080
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/01/28/setup-ssh-socks5-proxy-for-chrome/index.html b/2020/01/28/setup-ssh-socks5-proxy-for-chrome/index.html new file mode 100644 index 00000000..ff4a0462 --- /dev/null +++ b/2020/01/28/setup-ssh-socks5-proxy-for-chrome/index.html @@ -0,0 +1,202 @@ + + + + + + + + + + + + Setup SSH SOCKS5 proxy for Chrome | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Setup SSH SOCKS5 proxy for Chrome +

+ +

Setup SSH SOCKS5 proxy for Chrome

SSH server config

1
2
3
4
5
6
vi /etc/ssh/sshd_config
PermitRootLogin yes
Compression no
TCPKeepAlive no
ClientAliveInterval 15
ClientAliveCountMax 3
+ +

SSH client config

1
2
3
4
5
6
7
vi /etc/ssh/ssh_config
ConnectTimeout 5
Compression no
ExitOnForwardFailure yes
TCPKeepAlive no
ServerAliveInterval 12
ServerAliveCountMax 3
+ +

Setup SSH SOCKS5 proxy

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
while true; do
date
ssh -4 -D 10080 -N -p 22 -o "ServerAliveInterval 12" root@example.com
# ssh -6 -D 10080 -N -p 22 -o "ServerAliveInterval 12" root@example.com
echo
done

# -4 Forces ssh to use IPv4 addresses only.
# -6 Forces ssh to use IPv6 addresses only.
# -C Requests compression of all data
# -p port Port to connect to on the remote host.
# -f Requests ssh to go to background just before command execution.
# -q Quiet mode. Causes most warning and diagnostic messages to be suppressed.
# -N Do not execute a remote command. This is useful for just forwarding ports.
# -D [bind_address:]port Specifies a local “dynamic” application-level port forwarding.
# -L [bind_address:]port:host:hostport Specifies that connections to the given local host are to be forwarded to the given host and hostport.
+ +

Verify socks5 proxy

1
curl --socks5 127.0.0.1:10080 https://www.google.com
+ +

Running apt-get with proxy

sudo vi /etc/apt/apt.conf.d/zz-10-install

+
1
2
3
4
5
APT::Install-Recommends "0";
APT::Install-Suggests "0";

#Acquire::http { Proxy "http://www.example.com:8080"; };
Acquire::http { Proxy "socks5h://127.0.0.1:10080"; };
+ +

Check Chrome

1
2
$ google-chrome --version
Google Chrome 79.0.3945.130
+ +

Running Chrome with proxy

1
google-chrome --proxy-server="socks5://localhost:10080"
+ +

Running Chrome stay incognito

1
google-chrome --incognito --proxy-server="socks5://localhost:10080"
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/01/29/gpt-partition/index.html b/2020/01/29/gpt-partition/index.html new file mode 100644 index 00000000..e4d81f8b --- /dev/null +++ b/2020/01/29/gpt-partition/index.html @@ -0,0 +1,193 @@ + + + + + + + + + + + + GPT Partition | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ GPT Partition +

+ +

GPT Partition

Debian 10 on GPT Partition

1
2
3
4
5
6
7
8
9
10
11
12
13
14
$ sudo fdisk -l /dev/sdb
Disk /dev/sdb: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Disk model: ST500DM002-1BD14
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 3E509285-A069-48F4-AF14-0A38B272E3D6

Device Start End Sectors Size Type
/dev/sdb1 2048 1050623 1048576 512M EFI System
/dev/sdb2 1050624 2097151 1046528 511M Linux filesystem
/dev/sdb3 2097152 538968063 536870912 256G Linux LVM
/dev/sdb4 538968064 976773134 437805071 208.8G Microsoft basic data
+ +

RHEL 8 on GPT Partition

1
2
3
4
5
6
7
8
9
10
11
12
# fdisk -l /dev/sda
Disk /dev/sda: 4 TiB, 4398046511104 bytes, 8589934592 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 8F849392-8906-4965-AA07-306C3E1702D8

Device Start End Sectors Size Type
/dev/sda1 2048 1230847 1228800 600M EFI System
/dev/sda2 1230848 3327999 2097152 1G Linux filesystem
/dev/sda3 3328000 8589932543 8586604544 4T Linux LVM
+ +

Windows 10 on GPT Partition

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
$ sudo fdisk -l /dev/sda
Disk /dev/sda: 3.7 TiB, 4000787030016 bytes, 7814037168 sectors
Disk model: ST4000DM004-2CV1
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: EE646948-38BD-4F52-A564-72B94D20B500

Device Start End Sectors Size Type
/dev/sda1 2048 1023999 1021952 499M Windows recovery environment
/dev/sda2 1024000 1228799 204800 100M EFI System
/dev/sda3 1228800 1261567 32768 16M Microsoft reserved
/dev/sda4 1261568 1072511585 1071250018 510.8G Microsoft basic data
/dev/sda5 1072513024 1073741823 1228800 600M Windows recovery environment
/dev/sda6 1073743872 5368711167 4294967296 2T Microsoft basic data
+ +

Disable UTC and use Local Time in Linux

1
2
sudo timedatectl set-local-rtc 1 --adjust-system-clock
timedatectl
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/01/30/go-ipfs-0-4-23-released/index.html b/2020/01/30/go-ipfs-0-4-23-released/index.html new file mode 100644 index 00000000..fcff5a9d --- /dev/null +++ b/2020/01/30/go-ipfs-0-4-23-released/index.html @@ -0,0 +1,216 @@ + + + + + + + + + + + + go-ipfs 0.4.23 released | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ go-ipfs 0.4.23 released +

+ +

go-ipfs 0.4.23 released

Highlights

    +
  • Fixed a bug in the TLS transport that would (very rarely) cause disconnects during the handshake. You really should upgrade or you’ll see this bug more and more when TLS is enabled by default in go-ipfs 0.5.0.
  • +
  • Patched a commonly occurring bug in the websocket transport that was causing panics because of concurrent writes.
  • +
  • Fixed Resursive Resolving of dnsaddr Multiaddrs
  • +
  • Retuned Connection Manager
  • +
  • Reduced Relay Related DHT Spam
  • +
  • Better Bitswap
  • +
+

Assets

+

Download

ipfs get

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
ipfs get /ipns/dist.ipfs.io/go-ipfs/v0.4.23/go-ipfs_v0.4.23_linux-amd64.tar.gz
ipfs get /ipns/dist.ipfs.io/go-ipfs/v0.4.23/go-ipfs_v0.4.23_windows-amd64.zip

ipfs get -o go-ipfs_v0.4.23_linux-amd64.tar.gz QmW58T9uBd1gd6mnat254xk9B4b63dHN55T97icWATWv1K
ipfs get -o go-ipfs_v0.4.23_windows-amd64.zip QmfKbwBdmSy6UWaYBb3o6fXzxAvJKhMGoWzJwwjpftNN2r

# ipfs get /ipns/dist.ipfs.io/go-ipfs/v0.4.23/go-ipfs_v0.4.23_linux-amd64.tar.gz
Saving file(s) to go-ipfs_v0.4.23_linux-amd64.tar.gz
19.66 MiB / 19.66 MiB [====================================================================================] 100.00% 0s

# ipfs get /ipns/dist.ipfs.io/go-ipfs/v0.4.23/go-ipfs_v0.4.23_windows-amd64.zip
Saving file(s) to go-ipfs_v0.4.23_windows-amd64.zip
16.68 MiB / 16.68 MiB [====================================================================================] 100.00% 0s

# ipfs get -o go-ipfs_v0.4.23_linux-amd64.tar.gz QmW58T9uBd1gd6mnat254xk9B4b63dHN55T97icWATWv1K
Saving file(s) to go-ipfs_v0.4.23_linux-amd64.tar.gz
19.66 MiB / 19.66 MiB [====================================================================================] 100.00% 3s

# ipfs get -o go-ipfs_v0.4.23_windows-amd64.zip QmfKbwBdmSy6UWaYBb3o6fXzxAvJKhMGoWzJwwjpftNN2r
Saving file(s) to go-ipfs_v0.4.23_windows-amd64.zip
16.68 MiB / 16.68 MiB [====================================================================================] 100.00% 1s
+ +

gateway

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# gateway.ipfs.io, ipfs.infura.io, hardbin.com, siderus.io, ipfs.io

wget -O go-ipfs_v0.4.23_linux-amd64.tar.gz https://gateway.ipfs.io/ipfs/QmW58T9uBd1gd6mnat254xk9B4b63dHN55T97icWATWv1K
wget -O go-ipfs_v0.4.23_windows-amd64.zip https://gateway.ipfs.io/ipfs/QmfKbwBdmSy6UWaYBb3o6fXzxAvJKhMGoWzJwwjpftNN2r

curl -L -o go-ipfs_v0.4.23_linux-amd64.tar.gz https://gateway.ipfs.io/ipfs/QmW58T9uBd1gd6mnat254xk9B4b63dHN55T97icWATWv1K
curl -L -o go-ipfs_v0.4.23_windows-amd64.zip https://gateway.ipfs.io/ipfs/QmfKbwBdmSy6UWaYBb3o6fXzxAvJKhMGoWzJwwjpftNN2r

# curl -L -o go-ipfs_v0.4.23_linux-amd64.tar.gz https://gateway.ipfs.io/ipfs/QmW58T9uBd1gd6mnat254xk9B4b63dHN55T97icWATWv1K
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 19.6M 100 19.6M 0 0 11.3M 0 0:00:01 0:00:01 --:--:-- 11.3M

# curl -L -o go-ipfs_v0.4.23_windows-amd64.zip https://gateway.ipfs.io/ipfs/QmfKbwBdmSy6UWaYBb3o6fXzxAvJKhMGoWzJwwjpftNN2r
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 16.6M 100 16.6M 0 0 11.1M 0 0:00:01 0:00:01 --:--:-- 11.1M
+ +

Systemd service

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
groupadd -r ipfs && useradd -r -g ipfs ipfs

mkdir -p /var/lib/ipfs && IPFS_PATH=/var/lib/ipfs ipfs init

EDITOR=vi ipfs config edit

chown -R ipfs:ipfs /var/lib/ipfs

cat << EOF > /etc/systemd/system/ipfs.service
[Unit]
Description=ipfs
After=syslog.target network.target network-online.target remote-fs.target

[Service]
Type=simple
User=ipfs
Group=ipfs
RestartSec=5s
Restart=always

SyslogIdentifier=ipfs

Environment=IPFS_PATH=/var/lib/ipfs
#ExecStartPre=-/usr/bin/ipfs init
WorkingDirectory=/var/lib/ipfs
# WorkingDirectory=/tmp
ExecStart=/usr/bin/ipfs daemon

[Install]
WantedBy=multi-user.target
EOF

systemctl enable ipfs
systemctl stop ipfs
systemctl start ipfs
systemctl status ipfs

ipfs config show

# netstat -anp | grep ipfs | grep '*'
tcp 0 0 127.0.0.1:5001 0.0.0.0:* LISTEN 23692/ipfs
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 23692/ipfs
tcp 0 0 0.0.0.0:4001 0.0.0.0:* LISTEN 23692/ipfs
tcp6 0 0 :::8080 :::* LISTEN 23692/ipfs
tcp6 0 0 :::4001 :::* LISTEN 23692/ipfs
udp 0 0 0.0.0.0:5353 0.0.0.0:* 23692/ipfs
udp 0 0 0.0.0.0:38683 0.0.0.0:* 23692/ipfs
udp 0 0 0.0.0.0:4001 0.0.0.0:* 23692/ipfs
udp6 0 0 :::5353 :::* 23692/ipfs
udp6 0 0 :::33684 :::* 23692/ipfs
udp6 0 0 :::4001 :::* 23692/ipfs
+ +

Basic commands

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
ipfs id
ipfs bootstrap list
ipfs bootstrap rm all
ipfs bootstrap add --default
ipfs diag sys | jq .
ipfs swarm peers
ipfs swarm connect <multiaddr>

ipfs swarm peers | xargs -n 1 ipfs bootstrap add
sudo netstat -anp | grep ipfs | grep ESTABLISHED | wc -l

ipfs bootstrap add /ip4/192.168.1.139/tcp/4001/ipfs/QmaYbjkt2jifmnZU6a933fFjYEDVf5BMWkQSYCNMqvkRid
ipfs swarm connect /ip4/192.168.1.139/tcp/4001/ipfs/QmbSSqxrct6yB2xs1drDv8eCKBRdMJzSmYLVsTNnUTsDZU

while read PEER REST; do
ipfs bootstrap add "${PEER}"
ipfs swarm connect "${PEER}"
done << EOF
/ip4/149.248.32.245/tcp/4001/ipfs/QmRA4e86TZ6kkrQqja4gWY7fiSsPWFbVFmijiU6nTNMHg7
/ip4/149.248.32.245/udp/4001/quic/ipfs/QmRA4e86TZ6kkrQqja4gWY7fiSsPWFbVFmijiU6nTNMHg7
/ip6/2001:19f0:8001:1c86:5400:2ff:fe10:1f9f/tcp/4001/ipfs/QmRA4e86TZ6kkrQqja4gWY7fiSsPWFbVFmijiU6nTNMHg7
/ip6/2001:19f0:8001:1c86:5400:2ff:fe10:1f9f/udp/4001/quic/ipfs/QmRA4e86TZ6kkrQqja4gWY7fiSsPWFbVFmijiU6nTNMHg7
EOF

ipfs ls /ipns/dist.ipfs.io/go-ipfs/
ipfs cat /ipns/dist.ipfs.io/go-ipfs/versions
ipfs ls /ipns/dist.ipfs.io/go-ipfs/v0.4.23/
ipfs cat /ipns/dist.ipfs.io/go-ipfs/v0.4.23/dist.json
ipfs get /ipns/dist.ipfs.io/go-ipfs/v0.4.23/go-ipfs_v0.4.23_linux-amd64.tar.gz
ipfs get /ipns/dist.ipfs.io/go-ipfs/v0.4.23/go-ipfs_v0.4.23_windows-amd64.zip

ipfs repo version
ipfs repo stat
ipfs stats bw
ipfs stats repo
ipfs pin ls
ipfs pin verify

ipfs add --nocopy SLE-12-SP5-Server-DVD-x86_64-GM-DVD1.iso
ipfs add --only-hash SLE-12-SP5-Server-DVD-x86_64-GM-DVD1.iso
+ +

Experimental features

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
ipfs config --json Experimental.FilestoreEnabled true
ipfs config --json Experimental.UrlstoreEnabled true
ipfs config --json Experimental.PreferTLS true
ipfs config --json Experimental.QUIC true

EDITOR=vi ipfs config edit

"Addresses": {
"API": "/ip4/127.0.0.1/tcp/5001",
"Gateway": [
"/ip4/0.0.0.0/tcp/8080",
"/ip6/::/tcp/8080"
],
"Swarm": [
"/ip4/0.0.0.0/tcp/4001",
"/ip4/0.0.0.0/udp/4001/quic",
"/ip6/::/tcp/4001",
"/ip6/::/udp/4001/quic"
]
}
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/01/31/controlling-networkmanager-nmcli/index.html b/2020/01/31/controlling-networkmanager-nmcli/index.html new file mode 100644 index 00000000..2b5dee68 --- /dev/null +++ b/2020/01/31/controlling-networkmanager-nmcli/index.html @@ -0,0 +1,191 @@ + + + + + + + + + + + + Controlling NetworkManager - nmcli | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Controlling NetworkManager - nmcli +

+ +

Controlling NetworkManager

nmcli connection show

1
2
3
$ nmcli connection show
NAME UUID TYPE DEVICE
DONGSHENG-CMMC 58dba110-b6e9-4793-98cf-6f893f22de28 wifi wlx6c5ab5a4f8a7
+ +

nmcli device show

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
$ nmcli device show wlx6c5ab5a4f8a7
GENERAL.DEVICE: wlx6c5ab5a4f8a7
GENERAL.TYPE: wifi
GENERAL.HWADDR: 6C:5A:B5:A4:F8:A7
GENERAL.MTU: 1500
GENERAL.STATE: 100 (connected)
GENERAL.CONNECTION: DONGSHENG-CMMC
GENERAL.CON-PATH: /org/freedesktop/NetworkManager/ActiveConnection/1
IP4.ADDRESS[1]: 192.168.1.11/24
IP4.GATEWAY: 192.168.1.1
IP4.ROUTE[1]: dst = 192.168.1.0/24, nh = 0.0.0.0, mt = 600
IP4.ROUTE[2]: dst = 0.0.0.0/0, nh = 192.168.1.1, mt = 600
IP4.DNS[1]: 192.168.1.1
IP4.DNS[2]: 114.114.114.114
IP4.DNS[3]: 8.8.8.8
IP4.DNS[4]: 8.8.4.4
IP6.ADDRESS[1]: 2409:8a55:8b8:4560:1755:efdd:ae0e:b950/64
IP6.ADDRESS[2]: fe80::223f:a26d:9121:859d/64
IP6.GATEWAY: fe80::1
IP6.ROUTE[1]: dst = fe80::/64, nh = ::, mt = 600
IP6.ROUTE[2]: dst = 2409:8a55:8b8:4560::/64, nh = ::, mt = 600
IP6.ROUTE[3]: dst = ::/0, nh = fe80::1, mt = 600
IP6.ROUTE[4]: dst = ff00::/8, nh = ::, mt = 256, table=255
IP6.DNS[1]: fe80::1
+ +

nmcli connection modify

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
nmcli connection | tail -n+2 | grep --color '[0-9a-z]\{8\}-.\{28\}' -o | \
while read UUID; do
echo $UUID;
nmcli connection show $UUID | grep -i dns;
nmcli connection modify $UUID ipv4.ignore-auto-dns yes
nmcli connection modify $UUID ipv6.ignore-auto-dns yes
echo -e '\n\n';
done

# nmcli connection modify 58dba110-b6e9-4793-98cf-6f893f22de28 ipv4.dns "192.168.1.1,114.114.114.114,8.8.8.8,8.8.4.4"

$ nmcli connection show 58dba110-b6e9-4793-98cf-6f893f22de28 | grep "dns"
connection.mdns: -1 (default)
ipv4.dns: 192.168.1.1,114.114.114.114,8.8.8.8,8.8.4.4
ipv4.dns-search: --
ipv4.dns-options: ""
ipv4.dns-priority: 0
ipv4.ignore-auto-dns: yes
ipv6.dns: --
ipv6.dns-search: --
ipv6.dns-options: ""
ipv6.dns-priority: 0
ipv6.ignore-auto-dns: no
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/02/01/wi-fi-mac-addres-randomization/index.html b/2020/02/01/wi-fi-mac-addres-randomization/index.html new file mode 100644 index 00000000..d9b58806 --- /dev/null +++ b/2020/02/01/wi-fi-mac-addres-randomization/index.html @@ -0,0 +1,197 @@ + + + + + + + + + + + + Wi-Fi MAC addres Randomization | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Wi-Fi MAC addres Randomization +

+ +

Wi-Fi MAC addres Randomization

The NetworkManager 1.2.0 added MAC address randomization for Wi-Fi. The NetworkManager release 1.4.0 adds new features to change the current MAC address of your Ethernet or Wi-Fi card. This is also called MAC address “spoofing” or “cloning”.

+

NetworkManager supports two types MAC Address Randomization: randomization during scanning, and for network connections. Both modes can be configured by modifying /etc/NetworkManager/NetworkManager.conf.

+

MAC randomization can be used for increased privacy by not disclosing your real MAC address to the network.

+

Randomization during Wi-Fi scanning

During Wi-Fi scanning, NetworkManager resets the MAC address frequently to a randomly generated address. This default behavior can be disabled with a global configuration option in NetworkManager.conf

+
1
2
3
4
5
6
7
8
[main]
plugins=ifupdown,keyfile

[ifupdown]
managed=false

[device]
wifi.scan-rand-mac-address=no
+ +

MAC randomization for network connections

MAC randomization for network connections can be set to different modes for both wireless and ethernet interfaces. In terms of MAC randomization the most important modes are stable and random. stable generates a random MAC address when you connect to a new network and associates the two permanently. This means that you will use the same MAC address every time you connect to that network. In contrast, random will generate a new MAC address every time you connect to a network, new or previously known. You can configure the MAC randomization by adding the desired configuration under /etc/NetworkManager/conf.d:

+
1
2
3
4
5
6
7
8
9
[device-mac-randomization]
# "yes" is already the default for scanning
wifi.scan-rand-mac-address=yes

[connection-mac-randomization]
# Randomize MAC for every ethernet connection
ethernet.cloned-mac-address=random
# Generate a random MAC for each WiFi and associate the two permanently.
wifi.cloned-mac-address=stable
+ +

Troubleshooting

With Wi-Fi MAC addres Randomization, some Wi-Fi device can’t establish connection with any AP.

+

Disabling MAC address randomization may be needed to get (stable) link connection and/or networks that restrict devices based on their MAC Address or have a limit network capacity.

+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/02/02/disk-bandwidth-utilization/index.html b/2020/02/02/disk-bandwidth-utilization/index.html new file mode 100644 index 00000000..435ded95 --- /dev/null +++ b/2020/02/02/disk-bandwidth-utilization/index.html @@ -0,0 +1,202 @@ + + + + + + + + + + + + Disk bandwidth utilization | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Disk bandwidth utilization +

+ +

Disk bandwidth utilization

We can use the following tools to check the disk bandwidth utilization:

+
    +
  • iostat
  • +
  • dstat
  • +
  • atop
  • +
  • nmon
  • +
+

iostat

1
2
3
4
5
6
7
8
9
10
11
$ iostat -cdx 2
Linux 4.19.0-7-amd64 (OP-7020-01) 02/02/2020 _x86_64_ (8 CPU)

avg-cpu: %user %nice %system %iowait %steal %idle
5.23 0.00 2.83 2.34 0.00 89.60

Device r/s w/s rkB/s wkB/s rrqm/s wrqm/s %rrqm %wrqm r_await w_await aqu-sz rareq-sz wareq-sz svctm %util
sda 0.20 0.05 15.44 5.03 0.00 1.21 0.04 95.79 3.20 17.78 0.00 75.37 94.86 2.11 0.05
sdb 5.29 31.95 225.52 699.95 0.07 11.06 1.28 25.71 23.99 16.88 0.27 42.65 21.90 1.70 6.32
dm-0 5.42 43.00 214.50 726.57 0.00 0.00 0.00 0.00 25.20 22.85 1.12 39.59 16.90 3.46 16.75
dm-1 0.01 0.00 0.67 0.00 0.00 0.00 0.00 0.00 26.36 0.00 0.00 51.04 0.00 21.99 0.03
+ +

dstat

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
$ dstat -cdmngys --disk-util --disk-tps --disk-avgqu --disk-svctm

--total-cpu-usage-- -dsk/total- ------memory-usage----- -net/total- ---paging-- ---system-- ----swap--- sda--sdb- -dsk/total- sda--sdb- sda--sdb-
usr sys idl wai stl| read writ| used free buff cach| recv send| in out | int csw | used free|util:util|#read #writ|avgq:avgq|svct:svct
5 1 64 30 0|8155k 1512k|2389M 11.3G 6044k 2130M| 0 0 | 0 0 |3859 11k| 0 30G|2.84:78.6| 142 62 |0.06:4.26|4.63:3.96
6 2 68 23 0| 92k 4508k|2401M 11.3G 6044k 2130M|7398B 7963B| 0 0 |9825 31k| 0 30G| 0:37.2| 9 446 | 0:1.64| 0:0.82
5 2 66 27 0| 0 4180k|2371M 11.3G 6044k 2123M|9217B 6428B| 0 0 |7640 22k| 0 30G| 0:43.6| 0 646 | 0:3.77| 0:0.67
3 2 78 17 0| 200k 2652k|2373M 11.3G 6044k 2123M|7483B 3764B| 0 0 |5446 14k| 0 30G| 0:69.6| 2 471 | 0:3.68| 0:1.47
9 6 69 17 0|8444k 892k|2405M 11.3G 6044k 2131M|1628B 6406B| 0 0 | 11k 41k| 0 30G| 0:41.6| 86 191 | 0:0.59| 0:1.50
10 4 63 23 0|7132k 1728k|2404M 11.3G 6044k 2139M|2324B 2479B| 0 0 |9384 33k| 0 30G| 0:60.8| 81 326 | 0:1.66| 0:1.49
4 2 74 20 0|5292k 2032k|2408M 11.3G 6044k 2144M|2640B 6795B| 0 0 |6113 16k| 0 30G| 0:76.0| 52 364 | 0:2.86| 0:1.82
6 3 56 35 0| 11M 412k|2434M 11.2G 6044k 2155M| 10k 15k| 0 0 |8876 29k| 0 30G| 0:60.0| 115 85 | 0:1.03| 0:3.03
3 1 70 26 0| 24M 68k|2446M 11.2G 6044k 2179M| 14k 34k| 0 0 |5907 16k| 0 30G| 0:88.0| 263 17 | 0:1.78| 0:3.14
5 1 89 4 0|2616k 52k|2449M 11.2G 6044k 2181M|7083B 36k| 0 0 |5078 14k| 0 30G| 0:20.4| 33 17 | 0:0.23| 0:4.08
8 3 87 2 0|2332k 128k|2457M 11.2G 6044k 2184M|4222B 18k| 0 0 |8514 34k| 0 30G| 0:12.0| 26 28 | 0:0.14| 0:2.22
4 1 95 1 0| 0 36k|2457M 11.2G 6044k 2184M|2941B 4573B| 0 0 |4024 11k| 0 30G| 0: 0| 0 9 | 0: 0| 0: 0
5 2 92 2 0| 240k 100k|2458M 11.2G 6044k 2184M|9440B 17k| 0 0 |5460 15k| 0 30G| 0:8.80| 5 23 | 0:0.09| 0:3.14
4 2 92 2 0| 168k 60k|2457M 11.2G 6044k 2184M| 29k 38k| 0 0 |6146 15k| 0 30G| 0:7.20| 6 17 | 0:0.07| 0:3.13
5 2 92 2 0| 24k 120k|2463M 11.2G 6044k 2184M|5677B 12k| 0 0 |6024 20k| 0 30G| 0:4.40| 1 34 | 0:0.06| 0:1.26
4 2 94 1 0| 0 68k|2460M 11.2G 6044k 2184M| 11k 11k| 0 0 |5086 16k| 0 30G| 0: 0| 0 15 | 0: 0| 0: 0
4 1 94 1 0| 16k 84k|2461M 11.2G 6044k 2184M|4656B 11k| 0 0 |4808 13k| 0 30G| 0:2.80| 1 23 | 0:0.05| 0:1.17
2 1 96 0 0| 0 32k|2461M 11.2G 6044k 2184M|7677B 9178B| 0 0 |3956 11k| 0 30G| 0: 0| 0 10 | 0: 0| 0: 0
4 1 95 1 0| 0 24k|2461M 11.2G 6044k 2184M|7404B 7848B| 0 0 |4227 11k| 0 30G| 0: 0| 0 8 | 0: 0| 0: 0
3 1 94 1 0| 0 40k|2461M 11.2G 6044k 2184M|3431B 8807B| 0 0 |4554 12k| 0 30G| 0: 0| 0 14 | 0: 0| 0: 0
8 4 86 2 0| 500k 212k|2462M 11.2G 6044k 2185M|4894B 4823B| 0 0 |8808 34k| 0 30G| 0:10.4| 6 49 | 0:0.11| 0:1.89
2 1 95 2 0| 16k 24k|2462M 11.2G 6044k 2185M|3174B 7933B| 0 0 |3310 8956 | 0 30G| 0:6.00| 1 9 | 0:0.07| 0:6.00
2 1 96 1 0| 0 24k|2462M 11.2G 6044k 2185M|4609B 15k| 0 0 |4202 11k| 0 30G| 0: 0| 0 6 | 0: 0| 0: 0
3 1 96 1 0| 0 44k|2462M 11.2G 6044k 2185M|6262B 8518B| 0 0 |4008 11k| 0 30G| 0: 0| 0 15 | 0: 0| 0:
+ +

atop

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
ATOP - OP-7020-01                     2020/02/02  16:18:56                     --------------                     3h27m17s elapsed
PRC | sys 22m11s | user 49m20s | #proc 345 | #trun 1 | #tslpi 1365 | #tslpu 0 | #zombie 0 | #exit 1 |
CPU | sys 17% | user 42% | irq 5% | idle 717% | wait 19% | ipc notavail | curf 1.36GHz | curscal 34% |
cpu | sys 2% | user 5% | irq 0% | idle 89% | cpu002 w 3% | ipc notavail | curf 1.68GHz | curscal 42% |
cpu | sys 2% | user 5% | irq 0% | idle 90% | cpu006 w 2% | ipc notavail | curf 1.05GHz | curscal 26% |
cpu | sys 2% | user 5% | irq 3% | idle 88% | cpu000 w 2% | ipc notavail | curf 1.77GHz | curscal 44% |
cpu | sys 2% | user 5% | irq 0% | idle 90% | cpu003 w 2% | ipc notavail | curf 1.12GHz | curscal 28% |
cpu | sys 2% | user 5% | irq 0% | idle 90% | cpu007 w 2% | ipc notavail | curf 859MHz | curscal 21% |
cpu | sys 2% | user 5% | irq 1% | idle 89% | cpu001 w 3% | ipc notavail | curf 2.48GHz | curscal 62% |
cpu | sys 2% | user 5% | irq 0% | idle 90% | cpu004 w 2% | ipc notavail | curf 973MHz | curscal 24% |
cpu | sys 2% | user 5% | irq 0% | idle 91% | cpu005 w 2% | ipc notavail | curf 946MHz | curscal 23% |
CPL | avg1 0.82 | avg5 1.22 | avg15 1.21 | | csw 415298e3 | intr 68192e3 | | numcpu 8 |
MEM | tot 15.6G | free 6.8G | cache 5.0G | buff 25.4M | slab 650.6M | shmem 390.9M | vmbal 0.0M | hptot 0.0M |
SWP | tot 29.8G | free 29.8G | | | | | vmcom 14.7G | vmlim 37.6G |
LVM | os-root | busy 17% | read 66844 | write 533385 | KiB/w 16 | MBr/s 0.2 | MBw/s 0.7 | avio 3.46 ms |
LVM | os-swap | busy 0% | read 163 | write 0 | KiB/w 0 | MBr/s 0.0 | MBw/s 0.0 | avio 22.0 ms |
DSK | sdb | busy 6% | read 65234 | write 397037 | KiB/w 21 | MBr/s 0.2 | MBw/s 0.7 | avio 1.69 ms |
DSK | sda | busy 0% | read 2527 | write 654 | KiB/w 94 | MBr/s 0.0 | MBw/s 0.0 | avio 2.11 ms |
NET | transport | tcpi 2847603 | tcpo 2798383 | udpi 115650 | udpo 99884 | tcpao 226492 | tcppo 9402 | tcprs 197790 |
NET | network | ipi 3010484 | ipo 3124406 | ipfrw 32674 | deliv 2977e3 | | icmpi 10928 | icmpo 957 |
NET | wlx6c5a 0% | pcki 1421819 | pcko 1518298 | sp 108 Mbps | si 487 Kbps | so 139 Kbps | erri 0 | erro 0 |
NET | calib1d 0% | pcki 40428 | pcko 24341 | sp 10 Gbps | si 1 Kbps | so 5 Kbps | erri 0 | erro 0 |
NET | calibeb 0% | pcki 40341 | pcko 24273 | sp 10 Gbps | si 1 Kbps | so 5 Kbps | erri 0 | erro 0 |
NET | calic62 0% | pcki 5750 | pcko 6529 | sp 10 Gbps | si 0 Kbps | so 2 Kbps | erri 0 | erro 0 |
NET | cali7d4 0% | pcki 9853 | pcko 10632 | sp 10 Gbps | si 0 Kbps | so 0 Kbps | erri 0 | erro 0 |
NET | lo ---- | pcki 1547372 | pcko 1547372 | sp 0 Mbps | si 300 Kbps | so 300 Kbps | erri 0 | erro 0 |
NET | tunl0 ---- | pcki 0 | pcko 434 | sp 0 Mbps | si 0 Kbps | so 0 Kbps | erri 0 | erro 0 |
*** system and process activity since boot ***
PID SYSCPU USRCPU VGROW RGROW RUID EUID ST EXC THR S CPUNR CPU CMD 1/346
3163 4m44s 6m35s 539.4M 365.9M root root N- - 22 S 3 6% kube-apiserver
+ +

nmon

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

┌nmon─16i─────────────────────Hostname=OP-7020-01───Refresh=10secs ───16:23.01───────────────────────────────────────────────────┐
│ Disk I/O ──/proc/diskstats────mostly in KB/s─────Warning:contains duplicates───────────────────────────────────────────────────│
│DiskName Busy Read WriteKB|0 |25 |50 |75 100| │
│sda 0% 0.0 0.0|> | │
│sda1 0% 0.0 0.0|> | │
│sda2 0% 0.0 0.0|> | │
│sda3 0% 0.0 0.0|> | │
│sda4 0% 0.0 0.0|> | │
│sda5 0% 0.0 0.0|> | │
│sda6 0% 0.0 0.0|> | │
│sdb 1% 0.0 96.4|> | │
│sdb1 0% 0.0 0.0|> | │
│sdb2 0% 0.0 0.0|> | │
│sdb3 1% 0.0 96.4|> | │
│sdb4 0% 0.0 0.0|> | │
│dm-0 12% 0.0 102.0|WWWWW> | │
│dm-1 0% 0.0 0.0|> | │
│Totals Read-MB/s=0.0 Writes-MB/s=0.3 Transfers/sec=65.4 │
│────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────│
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
+ +

ioping

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$ ioping -c 9 /tmp/
4 KiB <<< /tmp/ (xfs /dev/dm-0): request=1 time=332.0 us (warmup)
4 KiB <<< /tmp/ (xfs /dev/dm-0): request=2 time=447.4 us
4 KiB <<< /tmp/ (xfs /dev/dm-0): request=3 time=561.7 us
4 KiB <<< /tmp/ (xfs /dev/dm-0): request=4 time=329.4 us
4 KiB <<< /tmp/ (xfs /dev/dm-0): request=5 time=399.0 us
4 KiB <<< /tmp/ (xfs /dev/dm-0): request=6 time=368.5 us
4 KiB <<< /tmp/ (xfs /dev/dm-0): request=7 time=195.1 us (fast)
4 KiB <<< /tmp/ (xfs /dev/dm-0): request=8 time=376.2 us
4 KiB <<< /tmp/ (xfs /dev/dm-0): request=9 time=356.8 us

--- /tmp/ (xfs /dev/dm-0) ioping statistics ---
8 requests completed in 3.03 ms, 32 KiB read, 2.64 k iops, 10.3 MiB/s
generated 9 requests in 8.00 s, 36 KiB, 1 iops, 4.50 KiB/s
min/avg/max/mdev = 195.1 us / 379.3 us / 561.7 us / 97.1 us
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/02/08/centos-8-stream/index.html b/2020/02/08/centos-8-stream/index.html new file mode 100644 index 00000000..85af53fd --- /dev/null +++ b/2020/02/08/centos-8-stream/index.html @@ -0,0 +1,283 @@ + + + + + + + + + + + + CentOS 8 Stream | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ CentOS 8 Stream +

+ +

Using AppStream

dnf module install nodejs:12/s2i
+
+module – They are set of packages
+nodejs – One of the module
+:12 – One of the Stream = Version
+/s2i – One of the profile.
+
+

Listing all available modules in AppStream

dnf module list
+
+

Gathering module Information

dnf module info rust-toolset
+dnf module info nodejs
+dnf module info --profile nodejs
+dnf module info --profile nodejs:10
+dnf module info --profile nodejs:12
+
+

Selecting a stream before installation of packages

dnf module enable nodejs
+dnf module enable python36
+dnf module disable nodejs
+
+

Installing a module stream

dnf install @nodejs:12/s2i
+dnf module install nodejs:12/s2i
+dnf module remove nodejs:12/s2i
+
+

Installing a non-default stream of an application

dnf module list postgresql
+dnf install @postgresql:12/server
+
+

Switching to a later stream

dnf distro-sync
+dnf upgrade
+dnf module reset module-name
+dnf module enable module-name:new-stream
+
+

CentOS 8 stream repository

+

/etc/yum.repos.d

# dnf clean all
+# dnf makecache
+
+# dnf distro-sync
+# dnf upgrade
+# rpm -qa | grep ^centos             
+centos-release-8.1-1.1911.0.8.el8.x86_64
+centos-gpg-keys-8.1-1.1911.0.8.el8.noarch
+centos-repos-8.1-1.1911.0.8.el8.x86_64
+
+# vi /etc/yum.repos.d/CentOS-Base.repo
+[Base]
+name=CentOS-$releasever - Base
+baseurl=http://mirrors.aliyun.com/centos/8/BaseOS/$basearch/os/
+#baseurl=http://mirrors.163.com/centos/8/BaseOS/$basearch/os/
+#baseurl=http://mirror.centos.org/centos/8/BaseOS/$basearch/os/
+gpgcheck=1
+enabled=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
+
+# vi /etc/yum.repos.d/CentOS-AppStream.repo
+[AppStream]
+name=CentOS-$releasever - AppStream
+baseurl=http://mirrors.aliyun.com/centos/8/AppStream/$basearch/os/
+#baseurl=http://mirrors.163.com/centos/8/AppStream/$basearch/os/
+#baseurl=https://mirror.centos.org/centos/8/AppStream/$basearch/os/
+gpgcheck=1
+enabled=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
+
+# vi /etc/yum.repos.d/CentOS-PowerTools.repo
+[PowerTools]
+name=CentOS-$releasever - PowerTools
+baseurl=http://mirrors.aliyun.com/centos/8/PowerTools/$basearch/os/
+#baseurl=http://mirrors.163.com/centos/8/PowerTools/$basearch/os/
+#baseurl=http://mirror.centos.org/centos/8/PowerTools/$basearch/os/
+gpgcheck=1
+enabled=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
+
+# vi /etc/yum.repos.d/CentOS-Extras.repo
+[Extra]
+name=CentOS-$releasever - Extra
+baseurl=http://mirrors.aliyun.com/centos/8/extras/$basearch/os/
+#baseurl=http://mirrors.163.com/centos/8/extras/$basearch/os/
+#baseurl=http://mirror.centos.org/centos/8/extras/$basearch/os/
+gpgcheck=1
+enabled=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
+
+# vi /etc/yum.repos.d/CentOS-Epel.repo
+[EPEL]
+name=CentOS-$releasever - EPEL
+baseurl=http://mirrors.aliyun.com/epel/$releasever/Everything/
+#baseurl=http://download.fedoraproject.org/pub/epel/$releasever/Everything/$basearch
+enabled=1
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8
+
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/02/09/nftables-load-balancer/index.html b/2020/02/09/nftables-load-balancer/index.html new file mode 100644 index 00000000..e9afa45c --- /dev/null +++ b/2020/02/09/nftables-load-balancer/index.html @@ -0,0 +1,247 @@ + + + + + + + + + + + + nftables load balancer | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ nftables load balancer +

+ +

nftables load balancer

+

What is nftables?

nftables replaces the popular **{ip,ip6,arp,eb}**tables. This software provides a new in-kernel packet classification framework that is based on a network-specific Virtual Machine (VM) and a new nft userspace command line tool. nftables reuses the existing Netfilter subsystems such as the existing hook infrastructure, the connection tracking system, NAT, userspace queueing and logging subsystem.

+

What is the status of nftables?

Available upstream since Linux kernel 3.13. It supports 3/4 of the existing iptables features, although it provides new features that you cannot find in iptables.

+

Running nftables

You require the following software in order to run the nft command line tool:

+
    +
  • Linux kernel since 3.13, although newer kernel versions are recommended.
  • +
  • libmnl: the minimalistic Netlink library
  • +
  • libnftnl: low level netlink userspace library
  • +
  • nft: command line tool
  • +
+

nft syntax differs from {ip,ip6,eb,arp}tables. Moreover, there is a backward compatibility layer that allows you run iptables/ip6tables, using the same syntax, over the nftables infrastructure.

+
nft list ruleset > /etc/nftables.rules
+nft flush ruleset
+nft -f /etc/nftables.rules
+
+

What is nftables load balancer?

nftlb stands for nftables load balancer, the next generation linux firewall that will replace iptables is adapted to behave as a complete load balancer and traffic distributor.

+

nftlb is a nftables rules manager to create virtual services for load balancing at layer 2, layer 3 and layer 4, minimizing the number of rules and using structures to match efficiently the packets. It’s also provided with an easy JSON API service to have the flexibility to interact with nftlb programmatically and to meet automation. So you can use your preferred health checker to be integrated with nftlb very easily.

+

The philosophy of nftlb is to maintain the data path into the kernel, in order to achieve the most performance possible, but the control plane and heath checks into user space to have the flexibility to change the behavior easily but also to be compatible with the rest of the linux stack.

+

At Zevenet, we’ve been using iptables and the netfilter infrastructure for years to create a full featured load balancer, hence we know very well the limitations of such approach that we’re saving with nftlb.

+

Why is nftlb needed

The linux kernel already counts of an internal load balancer called IPVS, or also known as LVS (Linux Virtual Server), which is a complete piece of software and very stable that has been used for years. But such load balancer has some limitations: the kernel side is used for tasks that should be performed by the user space, for certain capabilities it duplicates the infrastructure that currently netfilter provides, and it relies on iptables and other pieces of software if is required something more complex (like transparent proxy, multiport or multiprotocol). It provides SNAT and DSR topologies, but not DNAT.

+

With the iptables approach the main limitations are the number of rules to be created by virtual service and number of backends (a minimum of ~2 rules per backend with several matches included in it) and an increasing linear complexity according to the number of backends added. The sequentially processing of rules also slows down the performance if too much rules are included, and this is even worse due to the classic iptables locking problem. In order to provide IPv6 load balancing it has the inconvenience of the use a different command, ip6tables. In addition, this approach is able to provide DNAT (Destination NAT for transparency) and SNAT (Source NAT) load balancing but not able to work in DSR (Direct Server Return) topologies.

+

With nftlb based on nftables we save all of these issues:

+
    +
  • It can build all these topologies and change from one to another very easily.
  • +
  • It can handle multiport and multiprotocol natively.
  • +
  • It can manage IPv4 and IPv6 traffic seamlessly.
  • +
  • It’s used just one interface to provide all the required capabilities for load balancing.
  • +
  • nftables provides a more expressive language so we can use 2 rules to build a complete load balancer with constant complexity!
  • +
  • The matches are indexed per virtual service, so we don’t need to sequentially process all of them.
  • +
  • It is provided of the RCU subsystem so there is no locking problem when updating rules.
  • +
  • The data path remains in the kernel space but providing the flexibility in the user space for the control plane.
  • +
  • It has been proven that it can perform 10x faster than LVS.
  • +
+

nftlb features

Currently, nftlb provides the following capabilities:

+
    +
  • Topologies supported: Destination NAT, Source NAT, Direct Server Return and Stateless DNAT. This enables the use of the load balancer in one-armed and two-armed network architectures.
  • +
  • Support for both IPv4 and IPv6 families.
  • +
  • Multilayer load balancer: DSR in layer 2, IP based load balancing with protocol agnostic at layer 3, and support of load balancing of UDP, TCP and SCTP at layer 4.
  • +
  • Multiport support for ranges and lists of ports.
  • +
  • Multiple virtual services (or farms) support.
  • +
  • Schedulers available: weight, round robin, configurable hash (per IP, port, MAC or combination of them) and symmetric hash.
  • +
  • Support of configurable persistence or client-backend affinity with a timeout (per IP, port, MAC or combination of them).
  • +
  • Support of security policies per service: white and blacklists (from ingress), queuing to user space filter, filtering of bogus TCP frames, maximum number of established connections, limit TCP RST per second, limit new connections per second and more.
  • +
  • Priority support per backend.
  • +
  • Live management of virtual services and backends programmatically through a JSON API.
  • +
  • Web service authentication with a security Key.
  • +
  • Automated testbed included.
  • +
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/02/14/speed-up-apt-installation-or-upgrade/index.html b/2020/02/14/speed-up-apt-installation-or-upgrade/index.html new file mode 100644 index 00000000..4e38d361 --- /dev/null +++ b/2020/02/14/speed-up-apt-installation-or-upgrade/index.html @@ -0,0 +1,194 @@ + + + + + + + + + + + + Speed up apt installation or upgrade | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Speed up apt installation or upgrade +

+ +

Speed up apt installation or upgrade

Overview

    +
  1. Get URIs of fetching files
  2. +
  3. Download them by aria2c to utilize maximum bandwidth
  4. +
  5. Install packages from the cache
  6. +
+

Script (apt-fast.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
25
#!/bin/bash

[ "`whoami`" = root ] || exec sudo bash "$0" "$@"

which aria2c &>/dev/null || apt-get install -y --install-recommends aria2

if echo "$@" | grep -q "upgrade\|install\|dist-upgrade"; then
cd /var/cache/apt/archives/

deb_file_list=`mktemp`
trap "rm -f ${deb_file_list}" EXIT
apt-get -y --print-uris $@ | egrep -o -e "(http|https)://[^\']+" > ${deb_file_list}
cat ${deb_file_list}

aria2c -c -j 50 -x 5 -k 1m \
--connect-timeout=15 --timeout=15 --max-tries=0 \
--file-allocation=falloc --input-file=${deb_file_list}
if [ "$?" = "0" ] ; then
apt-get $@ -y
else
find /var/cache/apt/ -name "*.deb" -or -name "*.deb.aria2" | xargs -n 1 -r rm --
fi
else
apt-get $@
fi
+ +

Usage

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
bash apt-fast.sh upgrade

bash apt-fast.sh dist-upgrade

bash apt-fast.sh install mssql-server mssql-server-fts mssql-tools

# https://docs.microsoft.com/en-us/sql/sql-server/

sudo /opt/mssql/bin/mssql-conf setup

systemctl status mssql-server --no-pager

echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
source ~/.bashrc

sqlcmd -S localhost -U SA -P '<YourPassword>'

SELECT Name FROM sys.databases;
CREATE DATABASE TestDB;
USE TestDB;
GO
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/02/15/life-cycle-of-common-linux-distributions/index.html b/2020/02/15/life-cycle-of-common-linux-distributions/index.html new file mode 100644 index 00000000..faad321c --- /dev/null +++ b/2020/02/15/life-cycle-of-common-linux-distributions/index.html @@ -0,0 +1,233 @@ + + + + + + + + + + + + Life cycle of common Linux distributions | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Life cycle of common Linux distributions +

+ +

Life cycle of common Linux distributions

Alpine Linux Lifecycle

    +
  • https://alpinelinux.org/releases/
  • +
  • v3.14, [2021-06-15, 2023-05-01]
  • +
  • v3.15, [2021-11-24, 2023-11-01]
  • +
  • v3.16, [2022-05-23, 2024-05-23]
  • +
  • v3.17, [2022-11-22, 2024-11-22]
  • +
+

SUSE Linux Enterprise Server Lifecycle

+

Red Hat Enterprise Linux Lifecycle

+

CentOS Linux Lifecycle

+

Debian Linux Lifecycle

+

Ubuntu Linux lifecycle

    +
  • https://ubuntu.com/about/release-cycle
  • +
  • https://wiki.ubuntu.com/Releases
  • +
  • Ubuntu 16.04 LTS, Xenial Xerus, [April 2016, April 2021, April 2024]
  • +
  • Ubuntu 18.04 LTS, Bionic Beaver, [April 2018, April 2023, April 2028]
  • +
  • Ubuntu 20.04 LTS, Focal Fossa, [April 2020, April 2025, April 2030]
  • +
  • Ubuntu 22.04 LTS, Jammy Jellyfish, [April 2022, April 2027, April 2032]
  • +
+

openEuler Linux lifecycle

+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/02/16/linux-kernel-and-gnu-c-library-version-of-common-linux-distributions/index.html b/2020/02/16/linux-kernel-and-gnu-c-library-version-of-common-linux-distributions/index.html new file mode 100644 index 00000000..b0b0ea40 --- /dev/null +++ b/2020/02/16/linux-kernel-and-gnu-c-library-version-of-common-linux-distributions/index.html @@ -0,0 +1,502 @@ + + + + + + + + + + + + Linux Kernel and GNU C Library version of common Linux distributions | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Linux Kernel and GNU C Library version of common Linux distributions +

+ +

Linux Kernel and GNU C Library version of common Linux distributions

statically linking

statically linking the specified libraries:

+
-Wl,-Bstatic -lluajit-5.1 -lssl -lcrypto -lsctp -Wl,-Bdynamic
+
+

but if your static linking program use libdl and the GNU C Library version in the build system is newer than the version in the target system, you may get the following error:

+
# Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
+dl-call-libc-early-init.c:37: _dl_call_libc_early_init: Assertion `sym != NULL' failed.
+
+

glibc versions

If we link with the lowest version of the C Library, then we can achieve maximum compatibility.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Linux distributionRelease dateGNU C LibraryGCC support libraryLinux Kernel
Ubuntu 10.042010-042.11.14.4.32.6.32
Debian 62011-022.11.34.4.52.6.32
RHEL 62010-112.124.4.72.6.32
Debian 72013-052.134.7.23.2
Ubuntu 12.042012-042.154.6.33.2
RHEL 72014-062.174.8.53.10
Ubuntu 14.042014-042.194.9.33.13
SLE 122014-102.19 -> 2.224.8.3 -> 13.23.12 -> 4.12
Debian 82015-042.194.9.23.16
Ubuntu 16.042016-042.235.4.04.4
Debian 92017-062.246.34.9
Amazon Linux 2 LTS2018-062.267.34.14
SLE 152018-072.267.34.12
Ubuntu 18.042018-042.278.44.15
RHEL 82019-052.288.54.18
Debian 102019-072.288.34.19
openEuler 20.032020-032.287.34.19
Ubuntu 20.042020-042.3110.55.4
SLE 15 SP32021-062.3110.25.3
Debian 112021-082.3110.25.10
SLE 15 SP42022-062.3111.25.14
openEuler 22.032022-032.3410.35.10
RHEL 92022-052.3411.45.14
Amazon Linux 20232023-032.3411.46.1
CBL-Mariner 2.02022-052.3511.25.15
Ubuntu 22.042022-042.3512.35.15
Debian 122023-062.3612.26.1
openEuler 24.032024-062.3812.36.6
SLE 15 SP62024-062.3813.36.4
Ubuntu 24.042024-042.3914.06.8
Fedora 402024-042.3914.16.9
Ubuntu 24.102024-102.4014.26.11
CentOS Stream 102024-082.3914.26.11
Debian 132025-062.40 ?14.2 ?6.12 ?
RHEL 102025-082.40 ?14.2 ?6.12 ?
SUSE Adaptable Linux Platform (ALP)2025-??2.40 ?14.2 ?6.10 ?
openSUSE TumbleweedRolling2.40 ?14.2 ?6.10 ?
Alpine 3.182023-05musl 1.2.4libgcc 12.26.1
Alpine 3.192023-12musl 1.2.4libgcc 13.26.6
Alpine 3.202024-05musl 1.2.5libgcc 13.26.6
Alpine edge2024-11musl 1.2.5libgcc 14.26.6
+

libgcc versions

The following GCC versions add new functions to libgcc (libgcc/libgcc-std.ver.in and libgcc/config/i386/libgcc-glibc.ver):

+
    +
  • GCC 14.0.0
  • +
  • GCC 13.0.0
  • +
  • GCC 12.0.0
  • +
  • GCC 7.0.0
  • +
  • GCC 4.8.0
  • +
  • … (Too old to need to list anymore)
  • +
+

docker images

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# shopt -s checkwinsize
# echo "Lines: $(tput lines), Columns: $(tput cols)"
# echo "Lines: $LINES, Columns: $COLUMNS"
Lines: 30, Columns: 96

# podman images | grep '<none>' | awk '{print $3}' | xargs --no-run-if-empty podman rmi
# podman images | tail +2 | sort -V -k1,2 | while read IMG_PATH IMG_TAG REST; do date;echo podman pull $IMG_PATH:$IMG_TAG; podman pull $IMG_PATH:$IMG_TAG; echo; done
# podman images | tail +2 | sort -V -k1,2
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/library/almalinux 8 acaca326f3b3 8 weeks ago 196 MB
docker.io/library/almalinux 9 b0b3f56026dd 8 weeks ago 193 MB
docker.io/library/alpine 3.17 042a816809aa 2 weeks ago 7.34 MB
docker.io/library/debian 11 5c8936e57a38 2 weeks ago 129 MB
docker.io/library/debian testing 556061af5f11 2 weeks ago 121 MB
docker.io/library/ubuntu 20.04 d5447fc01ae6 7 weeks ago 75.2 MB
docker.io/library/ubuntu 22.04 6b7dfa7e8fdb 7 weeks ago 80.3 MB
docker.io/songdongsheng/openeuler 22.03 e2c2b88bb007 6 days ago 160 MB
ghcr.io/oracle/oraclelinux 7 258c049720a7 17 hours ago 271 MB
ghcr.io/oracle/oraclelinux 8 15d3782e65b8 17 hours ago 237 MB
ghcr.io/oracle/oraclelinux 9 6d4f5c87c123 17 hours ago 234 MB
mcr.microsoft.com/cbl-mariner/base/core 2.0 4ec990a6bc0d 39 hours ago 68.4 MB
public.ecr.aws/amazonlinux/amazonlinux 2 20b4c80b1755 4 days ago 172 MB
public.ecr.aws/amazonlinux/amazonlinux 2023 eef352c7a904 3 days ago 149 MB
quay.io/fedora/fedora 37 19c0ae4dd222 7 weeks ago 190 MB
quay.io/fedora/fedora 38 c9bfca6d0ac2 8 days ago 196 MB
registry.access.redhat.com/ubi7 latest f0c1470d8cb2 11 days ago 217 MB
registry.access.redhat.com/ubi7-minimal latest 0f3e1be52c0b 11 days ago 84.8 MB
registry.access.redhat.com/ubi8 latest 6a2ef33ab97f 3 weeks ago 214 MB
registry.access.redhat.com/ubi8-micro latest 03a08867970f 2 weeks ago 28.5 MB
registry.access.redhat.com/ubi8-minimal latest 35585f3ca6c6 3 weeks ago 94.5 MB
registry.access.redhat.com/ubi8/openjdk-11 latest 4383be399b12 10 days ago 397 MB
registry.access.redhat.com/ubi8/openjdk-11-runtime latest d526bdf5e61d 10 days ago 358 MB
registry.access.redhat.com/ubi8/openjdk-17 latest 59fd01ab51ad 10 days ago 408 MB
registry.access.redhat.com/ubi8/openjdk-17-runtime latest 42cb53376c53 10 days ago 366 MB
registry.access.redhat.com/ubi9 latest ed8d4815d368 11 days ago 219 MB
registry.access.redhat.com/ubi9-micro latest fc923451d5b9 11 days ago 26.1 MB
registry.access.redhat.com/ubi9-minimal latest 5b3c7c785802 11 days ago 97.4 MB
registry.access.redhat.com/ubi9/openjdk-11 latest cac6dcc81e20 10 days ago 393 MB
registry.access.redhat.com/ubi9/openjdk-11-runtime latest bde7a6c813fb 10 days ago 359 MB
registry.access.redhat.com/ubi9/openjdk-17 latest f3368e202a72 10 days ago 404 MB
registry.access.redhat.com/ubi9/openjdk-17-runtime latest aeb5671874f4 10 days ago 366 MB
registry.opensuse.org/opensuse/leap 15.4 ce2ffde521dc 2 weeks ago 116 MB
registry.opensuse.org/opensuse/tumbleweed latest c2a77db6cf5d 33 hours ago 106 MB
registry.suse.com/bci/bci-base 15.4 a357b1e79e7e 43 hours ago 122 MB
registry.suse.com/bci/bci-busybox 15.4 6a88b3a3c425 2 weeks ago 14.5 MB
registry.suse.com/bci/bci-micro 15.4 07d9e5464374 2 weeks ago 25.8 MB
registry.suse.com/bci/bci-minimal 15.4 ac521a188b44 28 hours ago 48.1 MB
registry.suse.com/bci/openjdk latest 0f14e1b28472 43 hours ago 334 MB
registry.suse.com/bci/openjdk-devel latest 68a33af805cf 22 hours ago 402 MB
registry.suse.com/suse/sle15 15.4 a357b1e79e7e 43 hours ago 122 MB
registry.suse.com/suse/sles12sp5 latest 9e344f88a8fc 25 hours ago 99.5 MB
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/02/22/aria2-default-configuration-file/index.html b/2020/02/22/aria2-default-configuration-file/index.html new file mode 100644 index 00000000..40da38ab --- /dev/null +++ b/2020/02/22/aria2-default-configuration-file/index.html @@ -0,0 +1,202 @@ + + + + + + + + + + + + aria2 default configuration file | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ aria2 default configuration file +

+ +

aria2 default configuration file

References

+

Common options

aria2c -c -m 0 -t 5 -j 8 -s 8 -x 8 -k 1m --file-allocation=none http://example.com/abc.zip
+
+

aria2.conf

The difference between is the configuration file aria2.conf path and file allocation method.

+

Linux

By default, aria2 checks whether the legacy path $HOME/.aria2/aria2.conf is present, otherwise it parses $XDG_CONFIG_HOME/aria2/aria2.conf as its configuration file.

+

If you are using newer file systems such as ext4 (with extents support), btrfs, xfs, falloc is your best choice. It allocates large(few GiB) files almost instantly.

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
cat << EOF | (mkdir -p $HOME/.aria2/ && tee $HOME/.aria2/aria2.conf)
# -c -m 0 -t 5 -j 8 -s 8 -x 8 -k 1m --file-allocation=falloc

continue=true
max-tries=0
connect-timeout=5
timeout=5

split=8
min-split-size=1M
max-connection-per-server=8
max-concurrent-downloads=64

# Linux on ext4 (with extents support), btrfs, xfs
file-allocation=falloc

# Windows use 'none', since 'falloc' need MinGW build, NTFS and SeManageVolumePrivilege
# file-allocation=none

#lowest-speed-limit=1K
max-overall-upload-limit=64K
EOF
+ +

Windows

aria2 parses %USERPROFILE%\.aria2\aria2.conf as its configuration file.

+

If you are using falloc as your file allocation method, you must have SeManageVolumePrivilege privilege.

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# -c -m 0 -t 5 -j 8 -s 8 -x 8 -k 1m --file-allocation=none
continue=true
max-tries=0
connect-timeout=5
timeout=5

split=8
min-split-size=1M
max-connection-per-server=8
max-concurrent-downloads=64

file-allocation=none

#lowest-speed-limit=1K
max-overall-upload-limit=64K
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/02/23/mips-processors/index.html b/2020/02/23/mips-processors/index.html new file mode 100644 index 00000000..be5c7c72 --- /dev/null +++ b/2020/02/23/mips-processors/index.html @@ -0,0 +1,255 @@ + + + + + + + + + + + + MIPS Processors | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ MIPS Processors +

+ +

MIPS Processors

自从 2014 年发布 MIPS R6 版本之后, MIPS 公司的 IP Core 产品全面转向 MIPS R6 版本,形成覆盖高中低不同性能和应用需求的 Warrior 产品系列, 而把 R6 之前的产品全部归为 Classic 系列。 Warrior 产品系列又分为 M-Class, I-Class 和 P-Class 三个级别,覆盖了从 32 位微控制器到 64 位服务器与基础设施之间的所有领域。

+
    +
  • P-class 采用 MIPS R6 MIPS 指令集,当前的产品是 P6600 (MIPS64 R6) 和 P5600 (32-bit MIPS32 R5)。
  • +
  • I-class 采用 MIPS R6 nanoMIPS 指令集,用于嵌入式设备,当前的产品是 I7200 (2.1 GHz, 32-bit nanoMIPS),I6500-F (MIPS64 R6),I6500 (MIPS64 R6) 和 I6400 (MIPS64 R6)。
  • +
  • M-class 采用 MIPS R6 microMIPS 指令集,用于微控制器,当前的产品是 M6250 (64 bit,4GB Virtual Memory,750 MHz),M6200,M51xx。
  • +
+

The MIPS32® and MIPS64® instruction-set architectures, which are seamlessly compatible, allow customers to port from one generation to the next while preserving their investment in existing software.

+

microMIPS®, a code compression Instruction Set Architecture (ISA) comprised of 16- and 32- bit instructions, that provides similar performance to MIPS32 with a code size reduction of up to 25%.

+

nanoMIPS designed for embedded devices, it can deliver up to 40% smaller code than MIPS32. With smaller memory accesses and efficient use of the instruction cache, nanoMIPS also helps to reduce system power consumption.

+

Architecture modules that are encompassed as part of the base architecture include SIMD (Single Instruction Multiple Data operation), Virtualization, Multi-threading (MT) and DSP technologies.

+

Based on a heritage built over more than three decades of constant innovation, the MIPS architecture is the industry’s most efficient RISC architecture, delivering the best performance and lowest power consumption in a given silicon area.

+
    +
  • nanoMIPS Architecture
  • +
  • MIPS32 Instruction Set Architecture (ISA)
  • +
  • MIPS64 Architecture ISA
  • +
  • microMIPS ISA
  • +
  • MIPS Multi-Threading architecture module
  • +
  • MIPS Virtualization architecture module
  • +
  • MIPS SIMD architecture module
  • +
  • MIPS DSP architecture module
  • +
  • MIPS MCU architecture module
  • +
  • MIPS16e architecture module
  • +
+

MIPS32 Architecture

+

The MIPS32 architecture provides seamless upward compatibility to the 64-bit MIPS64® architecture, bringing powerful features, standardized privileged mode instructions, and support for past ISA versions. The MIPS32 architecture incorporates important functionality including SIMD (Single Instruction Multiple Data) and virtualization. These technologies, in conjunction with technologies such as multi-threading (MT), DSP extensions and EVA (Enhanced Virtual Addressing) enrich the architecture for use with modern software workloads which require larger memory sizes, increased computational horsepower and secure execution environments.

+

MIPS64 Architecture

+

The MIPS64® architecture provides a solid high-performance foundation for future MIPS processor-based development by incorporating powerful features, standardizing privileged mode instructions, supporting past ISAs, and providing a seamless upgrade path from the MIPS32 architecture.

+

The MIPS32 and MIPS64 architectures incorporate important functionality including SIMD (Single Instruction Multiple Data) and virtualization. These technologies, in conjunction with technologies such as multi-threading (MT), DSP extensions and EVA (Enhanced Virtual Addressing), enrich the architecture for use with modern software workloads which require larger memory sizes, increased computational horsepower and secure execution environments.

+

nanoMIPS Architecture

Designed for embedded devices, nanoMIPS is a variable lengths instruction set architecture (ISA) offering high performance in substantially reduced code size. Under comparable compiler flags, it can deliver up to 40% smaller code than MIPS32. With smaller memory accesses and efficient use of the instruction cache, nanoMIPS also helps to reduce system power consumption.

+

The nanoMIPS ISA combines recoded and new 16-, 32-, and 48-bit instructions to achieve an ideal balance of performance and code density. It incorporates all MIPS32 instructions and architecture modules including MIPS DSP and MIPS MT, as well as new instructions for advanced code size reduction.

+

nanoMIPS is supported in release 6 of the MIPS architecture. It is first implemented in the new MIPS I7200 multi-threaded multi-core processor series. Compiler support is included in the MIPS GNU-based development tools.

+

microMIPS Architecture

Designed for microcontrollers and other small footprint embedded devices, microMIPS is a code compression instruction set architecture (ISA) that offers 32-bit performance with 16-bit code size for most instructions. It maintains 98% of MIPS32 performance while reducing code size by up to 25%, translating to significant silicon cost savings. With smaller memory accesses and efficient use of the instruction cache, microMIPS also helps to reduce system power consumption.

+

The microMIPS ISA combines recoded and new 16- and 32-bit instructions to achieve an ideal balance of performance and code density. It incorporates all MIPS32 instructions and architecture modules including MIPS DSP and MIPS MT, as well as new instructions for advanced code size reduction. The microMIPS ISA is backward compatible, enabling reuse of optimized MIPS microarchitecture.

+

microMIPS is supported in releases r3, r5 and r6 of the MIPS architecture. It is implemented in MIPS CPUs including the M14K, microAptiv, and the Warrior M51xx and M62xx series of cores.

+

MIPS Architecture Modules

MIPS offers a series of architecture modules that allow designers to extend their MIPS32, MIPS64 or microMIPS instruction sets for additional functionality.

+

MIPS Multi-threading

Hardware multi-threading can make a single processor core appear and function like multiple separate cores for improved performance and efficiency. MIPS delivers this capability in several families of our licensable CPU IP products, providing a differentiated and highly efficient mechanism to achieve higher levels of performance and/or low latency context switching behavior. Find out more about MIPS Multi-threading.

+

MIPS Virtualization

The MIPS Virtualization (VZ) module provides the foundation for MIPS multi-domain security technology, and enables consolidation of multiple different embedded CPUs into a single core, resulting in lower silicon area and development effort, ultimately decreasing the overall cost and extending battery life.

+

MIPS SIMD

The MIPS SIMD Architecture (MSA) incorporates a software-programmable solution into the CPU to handle emerging codecs or a small number of functions not covered by dedicated hardware. This programmable solution allows for increased system flexibility. In addition, the MSA is designed to accelerate many compute-intensive applications by enabling generic compiler support.

+

MIPS DSP

The MIPS DSP module offers licensees a programmable solution for DSP applications, allowing adaptation to changing market needs and extending the life of an SoC design. The DSP module comprises a set of instructions and state in the integer pipeline of MIPS cores and requires minimal additional logic to implement.

+

MIPS MCU

The MIPS MCU module provides key enhancements for microcontroller applications including enhanced handling of memory-mapped I/O registers and lower interrupt latencies.

+

MIPS16e

The MIPS16e module is composed of 16-bit compressed code instructions, designed for the embedded processor market and situations with tight memory constraints. The core can execute both 16- and 32-bit instructions intermixed in the same program, and is compatible with both the MIPS32 and MIPS64 Architectures.

+

Preferred CPU models for Qemu

    +
  • MIPS32R6, mips32r6-generic
  • +
  • MIPS64R6, I6400
  • +
  • nanoMIPS, I7200
  • +
  • MIPS32R2, 34Kf
  • +
  • MIPS64R2, MIPS64R2-generic
  • +
+

MIPS-powered SoC

    +
  • 74Kc (2007), Qualcomm Atheros (AR9344 QCA9558), MediaTek (RT3662 RT3883) Broadcom (BCM4706)
  • +
  • 1004Kc (2008), MediaTek (MT7621[1004KEc, 880MHz, 32-bit, 2 Gbps routing])
  • +
  • 1074Kc (2010), Realtek (RTL8198C)
  • +
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/02/25/usb-bluetooth-adaper/index.html b/2020/02/25/usb-bluetooth-adaper/index.html new file mode 100644 index 00000000..f60d5867 --- /dev/null +++ b/2020/02/25/usb-bluetooth-adaper/index.html @@ -0,0 +1,252 @@ + + + + + + + + + + + + USB Bluetooth Adaper | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ USB Bluetooth Adaper +

+ +

USB Bluetooth Adaper

Introductions

+

国内市场上的 USB 蓝牙适配器,大多数基于 CSR8510 芯片,少数采用 BCM20702 芯片,都是蓝牙 4.0 产品。基于 BR8041 芯片的低端产品从 2019 下半年开始陆续出现。

+

BR8041

百瑞互联的 BR8041 于 2019 年 1 月通过了 SIG Bluetooth 5.0 的认证。BR8041 声称兼容 BCM20702 和 CSR8510,并且因为没有官方驱动,所以通常被识别为 CSR8510。它与 Linux 的兼容性很差,个人尝试不成功,也没有搜索到成功案例。在 Windows 10 下,使用系统内置驱动工作不够稳定,会频繁断开,或者报告驱动程序错误。

+

代表产品是胜为的 UDC-328B,19.9 包邮。

+
1
2
3
4
5
6
7
8
9
10
# btmon

< HCI Command: Delete Stored Link Key (0x03|0x0012) plen 7 #59 [hci0] 47.447047
Address: 00:00:00:00:00:00 (OUI 00-00-00)
Delete all: 0x01
> HCI Event: Command Complete (0x0e) plen 6 #60 [hci0] 47.447946
Delete Stored Link Key (0x03|0x0012) ncmd 1
Status: Unsupported Feature or Parameter Value (0x11)
Num keys: 0
= Close Index: 00:1A:7D:DA:71:11 [hci0] 47.448017
+ +

CSR8510 - UGREEN CM109

Specifications

    +
  • Bluetooth adapter 30722
  • +
  • CMIIT ID: 2017DP1793
  • +
  • 产品型号:CM109
  • +
  • 产品尺寸:L27.5xW16xH7.5(mm)
  • +
  • 芯片型号:CSR8510
  • +
  • 蓝牙版本:4.0
  • +
  • 传输频率:2.4GHz
  • +
  • 传输速率:3Mbps
  • +
  • 无障碍传输距离:20m
  • +
  • USB 接口:2.0 A 公接口
  • +
  • 协议:HFP 1.5,HSP 1.2,AVRCP 1.4,A2DP 1.2,FTB 1.1
  • +
  • 支持 Windows XP,Vista 和 7/8/10
  • +
+

Linux

dmesg

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
$ dmesg | grep -i Bluetooth
[ 223.346181] usb 2-8: new full-speed USB device number 5 using xhci_hcd
[ 223.588222] usb 2-8: New USB device found, idVendor=0a12, idProduct=0001, bcdDevice=88.91
[ 223.588227] usb 2-8: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[ 223.588229] usb 2-8: Product: CSR8510 A10
[ 223.728329] alg: No test for fips(ansi_cprng) (fips_ansi_cprng)
[ 223.783748] Bluetooth: Core ver 2.22
[ 223.783765] NET: Registered protocol family 31
[ 223.783765] Bluetooth: HCI device and connection manager initialized
[ 223.783768] Bluetooth: HCI socket layer initialized
[ 223.783769] Bluetooth: L2CAP socket layer initialized
[ 223.783773] Bluetooth: SCO socket layer initialized
[ 223.815292] usbcore: registered new interface driver btusb
[ 224.067336] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[ 224.067337] Bluetooth: BNEP filters: protocol multicast
[ 224.067340] Bluetooth: BNEP socket layer initialized
[ 224.113811] Bluetooth: RFCOMM TTY layer initialized
[ 224.113818] Bluetooth: RFCOMM socket layer initialized
[ 224.113825] Bluetooth: RFCOMM ver 1.11

[ 265.491088] usb 2-8: USB disconnect, device number 5

[ 268.881973] usb 2-8: new full-speed USB device number 6 using xhci_hcd
[ 269.131874] usb 2-8: New USB device found, idVendor=0a12, idProduct=0001, bcdDevice=88.91
[ 269.131880] usb 2-8: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[ 269.131883] usb 2-8: Product: CSR8510 A10
+ +

lsusb

1
2
3
4
5
6
7
8
9
10
11
# lsusb
Bus 004 Device 002: ID 8087:8000 Intel Corp.
Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:8008 Intel Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 002 Device 006: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Bus 002 Device 002: ID 04ca:0061 Lite-On Technology Corp.
Bus 002 Device 004: ID 1c4f:0002 SiGma Micro Keyboard TRACER Gamma Ivory
Bus 002 Device 003: ID 148f:5572 Ralink Technology, Corp. RT5572 Wireless Adapter
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
+ +
1
2
3
4
5
6
7
8
# usb-devices | awk '/0a12/' RS=
T: Bus=02 Lev=01 Prnt=01 Port=07 Cnt=04 Dev#= 6 Spd=12 MxCh= 0
D: Ver= 2.00 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=0a12 ProdID=0001 Rev=88.91
S: Product=CSR8510 A10
C: #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
I: If#=0x0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
I: If#=0x1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
+ +
1
lsusb -v -d 0a12:0001
+ +

hwinfo

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# hwinfo --bluetooth
01: USB 00.0: 11500 Bluetooth Device
[Created at usb.122]
Unique ID: 1Nxo.nQKjiuCfL84
Parent ID: pBe4.2DFUsyrieMD
SysFS ID: /devices/pci0000:00/0000:00:14.0/usb2/2-8/2-8:1.0
SysFS BusID: 2-8:1.0
Hardware Class: bluetooth
Model: "Cambridge Silicon Radio Bluetooth Dongle (HCI mode)"
Hotplug: USB
Vendor: usb 0x0a12 "Cambridge Silicon Radio, Ltd"
Device: usb 0x0001 "Bluetooth Dongle (HCI mode)"
Revision: "88.91"
Driver: "btusb"
Driver Modules: "btusb"
Speed: 12 Mbps
Module Alias: "usb:v0A12p0001d8891dcE0dsc01dp01icE0isc01ip01in00"
Driver Info #0:
Driver Status: btusb is active
Driver Activation Cmd: "modprobe btusb"
Config Status: cfg=new, avail=yes, need=no, active=unknown
Attached to: #12 (Hub)
+ +

hciconfig

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# hciconfig -a
hci0: Type: Primary Bus: USB
BD Address: 00:1A:7D:DA:71:11 ACL MTU: 310:10 SCO MTU: 64:8
UP RUNNING
RX bytes:682 acl:0 sco:0 events:48 errors:0
TX bytes:3163 acl:0 sco:0 commands:48 errors:0
Features: 0xff 0xff 0x8f 0xfe 0xdb 0xff 0x5b 0x87
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
Link policy: RSWITCH HOLD SNIFF PARK
Link mode: SLAVE ACCEPT
Name: 'OP-7020-01'
Class: 0x0c0104
Service Classes: Rendering, Capturing
Device Class: Computer, Desktop workstation
HCI Version: 4.0 (0x6) Revision: 0x22bb
LMP Version: 4.0 (0x6) Subversion: 0x22bb
Manufacturer: Cambridge Silicon Radio (10)
+ +
1
2
3
4
5
6
# hciconfig hci0 version
hci0: Type: Primary Bus: USB
BD Address: 00:1A:7D:DA:71:11 ACL MTU: 310:10 SCO MTU: 64:8
HCI Version: 4.0 (0x6) Revision: 0x22bb
LMP Version: 4.0 (0x6) Subversion: 0x22bb
Manufacturer: Cambridge Silicon Radio (10)
+ +
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# hciconfig hci0 features
hci0: Type: Primary Bus: USB
BD Address: 00:1A:7D:DA:71:11 ACL MTU: 310:10 SCO MTU: 64:8
Features page 0: 0xff 0xff 0x8f 0xfe 0xdb 0xff 0x5b 0x87
<3-slot packets> <5-slot packets> <encryption> <slot offset>
<timing accuracy> <role switch> <hold mode> <sniff mode>
<park state> <RSSI> <channel quality> <SCO link> <HV2 packets>
<HV3 packets> <u-law log> <A-law log> <CVSD> <paging scheme>
<power control> <transparent SCO> <broadcast encrypt>
<EDR ACL 2 Mbps> <EDR ACL 3 Mbps> <enhanced iscan>
<interlaced iscan> <interlaced pscan> <inquiry with RSSI>
<extended SCO> <EV4 packets> <EV5 packets> <AFH cap. slave>
<AFH class. slave> <LE support> <3-slot EDR ACL>
<5-slot EDR ACL> <sniff subrating> <pause encryption>
<AFH cap. master> <AFH class. master> <EDR eSCO 2 Mbps>
<EDR eSCO 3 Mbps> <3-slot EDR eSCO> <extended inquiry>
<LE and BR/EDR> <simple pairing> <encapsulated PDU>
<non-flush flag> <LSTO> <inquiry TX power> <EPC>
<extended features>
Features page 1: 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00
+ +
1
2
3
hciconfig hci down
hciconfig hci up
hcitool dev
+ +

bluetoothctl

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
$ bluetoothctl version
Version 5.50

$ bluetoothctl list
Controller 00:1A:7D:DA:71:11 OP-7020-01 [default]

$ bluetoothctl devices
Device FC:58:FA:FB:68:35 T5S
Device AC:C1:EE:0C:77:AB 小米手机5
Device E0:B6:55:60:54:2D MI BT18 BLE

$ bluetoothctl info FC:58:FA:FB:68:35
Device FC:58:FA:FB:68:35 (public)
Name: T5S
Alias: T5S
Class: 0x00260404
Icon: audio-card
Paired: yes
Trusted: yes
Blocked: no
Connected: yes
LegacyPairing: no
UUID: Headset (00001108-0000-1000-8000-00805f9b34fb)
UUID: Audio Sink (0000110b-0000-1000-8000-00805f9b34fb)
UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
UUID: A/V Remote Control (0000110e-0000-1000-8000-00805f9b34fb)
UUID: Handsfree (0000111e-0000-1000-8000-00805f9b34fb)
RSSI: -47

$ bluetoothctl info
Device FC:58:FA:FB:68:35 (public)
Name: T5S
Alias: T5S
Class: 0x00260404
Icon: audio-card
Paired: yes
Trusted: yes
Blocked: no
Connected: yes
LegacyPairing: no
UUID: Headset (00001108-0000-1000-8000-00805f9b34fb)
UUID: Audio Sink (0000110b-0000-1000-8000-00805f9b34fb)
UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
UUID: A/V Remote Control (0000110e-0000-1000-8000-00805f9b34fb)
UUID: Handsfree (0000111e-0000-1000-8000-00805f9b34fb)
RSSI: -47

$ bluetoothctl show
Controller 00:1A:7D:DA:71:11 (public)
Name: OP-7020-01
Alias: OP-7020-01
Class: 0x001c0104
Powered: yes
Discoverable: no
Pairable: yes
UUID: Headset AG (00001112-0000-1000-8000-00805f9b34fb)
UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
UUID: A/V Remote Control (0000110e-0000-1000-8000-00805f9b34fb)
UUID: OBEX File Transfer (00001106-0000-1000-8000-00805f9b34fb)
UUID: Generic Access Profile (00001800-0000-1000-8000-00805f9b34fb)
UUID: OBEX Object Push (00001105-0000-1000-8000-00805f9b34fb)
UUID: PnP Information (00001200-0000-1000-8000-00805f9b34fb)
UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
UUID: IrMC Sync (00001104-0000-1000-8000-00805f9b34fb)
UUID: Audio Source (0000110a-0000-1000-8000-00805f9b34fb)
UUID: Audio Sink (0000110b-0000-1000-8000-00805f9b34fb)
UUID: Vendor specific (00005005-0000-1000-8000-0002ee000001)
UUID: Message Notification Se.. (00001133-0000-1000-8000-00805f9b34fb)
UUID: Phonebook Access Server (0000112f-0000-1000-8000-00805f9b34fb)
UUID: Message Access Server (00001132-0000-1000-8000-00805f9b34fb)
UUID: Headset (00001108-0000-1000-8000-00805f9b34fb)
Modalias: usb:v1D6Bp0246d0532
Discovering: yes
+ +

btmon

1
2
3
4
5
6
7
8
9
# btmon
< HCI Command: Delete Stored Link Key (0x03|0x0012) plen 7 #59 [hci0] 5.497484
Address: 00:00:00:00:00:00 (OUI 00-00-00)
Delete all: 0x01
> HCI Event: Command Complete (0x0e) plen 6 #60 [hci0] 5.498427
Delete Stored Link Key (0x03|0x0012) ncmd 1
Status: Unsupported Feature or Parameter Value (0x11)
Num keys: 0
= Close Index: 00:1A:7D:DA:71:11
+ +

hcidump

1
(hciconfig hci0 down;hciconfig hci0 up);(hcidump &);hciconfig hci0 down
+ +

BCM20702 - UDC-324

Specifications

    +
  • 蓝牙版本:4.0
  • +
  • 无障碍传输距离:20m
  • +
  • 24 bit CRC 抗干扰
  • +
  • 自动跳频减少串扰
  • +
  • 芯片组:博通 20702A3
  • +
  • 供应商 ID:0x0A5C
  • +
  • 产品 ID:0x21EC
  • +
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/02/27/running-a-container-with-a-non-root-user/index.html b/2020/02/27/running-a-container-with-a-non-root-user/index.html new file mode 100644 index 00000000..61d8e3cb --- /dev/null +++ b/2020/02/27/running-a-container-with-a-non-root-user/index.html @@ -0,0 +1,240 @@ + + + + + + + + + + + + Running a Container With a Non Root User | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Running a Container With a Non Root User +

+ +

Running a Container With a Non Root User

+

Introduction

设计良好的系统遵循最小特权原则。即应用程序仅应有权访问其执行其所需功能所需的资源。这在设计安全系统时至关重要。无论是恶意的还是由于错误的程序,一个进程在运行时都可能产生意想不到的后果。保护自己免受任何意外访问的最佳方法之一是仅授予运行某个进程所需的最小特权。

+

多数容器化流程是应用程序服务,因此不需要以 root 身份运行,也不应假定它们是 root。而是应该在 Dockerfile 中创建一个具有已知 UID 和 GID 的用户,然后以该用户身份运行您的进程。因为限制了对资源的访问,从而镜像更易于安全运行。

+

Recommendation

    +
  • 使用 root 执行特权操作
      +
    1. (可选) Multi-Stage Builds
    2. +
    3. FROM 指令,指定基础镜像
    4. +
    5. COPY 指令,复制应用程序的文件
    6. +
    7. RUN 指令,创建应用程序需要的目录或文件
    8. +
    9. RUN 指令,(可选)安装所需的软件包
    10. +
    11. RUN 指令,(可选)使用系统工具处理配置文件等
    12. +
    13. RUN 指令,创建系统用户组和系统用户 (-r),切记要显式创建用户组,SUSE 的默认组和其它系统不一样
    14. +
    15. RUN 指令,为新建的系统用户赋予目录和文件权限,修改属主时记得使用递归选项 -R
    16. +
    +
  • +
  • 使用新建用户运行应用程序服务
      +
    1. USER 指令
    2. +
    3. ENTRYPOINT 和 CMD 指令
    4. +
    +
  • +
+

以 root 身份运行的镜像

1
2
3
4
5
FROM openjdk:8u242
COPY cassandra-table-cleanup.jar /var/lib/cassandra-table-cleanup/lib/
RUN mkdir -p /var/lib/cassandra-table-cleanup/log
WORKDIR /var/lib/cassandra-table-cleanup/log/
CMD ["/usr/bin/java", "-jar", "/var/lib/cassandra-table-cleanup/lib/cassandra-table-cleanup.jar"]
+ +

以 monte 身份运行的镜像

1
2
3
4
5
6
7
8
9
FROM openjdk:8u242

COPY cassandra-table-cleanup.jar /var/lib/cassandra-table-cleanup/lib/
RUN mkdir -p /var/lib/cassandra-table-cleanup/log/ && \
groupadd -r monte && useradd -r -g monte monte && \
chown -R monte:monte /var/lib/cassandra-table-cleanup
WORKDIR /var/lib/cassandra-table-cleanup/log/
USER monte
CMD ["/usr/bin/java", "-jar", "/var/lib/cassandra-table-cleanup/lib/cassandra-table-cleanup.jar"]
+ +

Tricks

用户组和用户

    +
  1. useradd 不指定 -r,创建用户时可能会进入交互模式,提示输入密码,所以 groupadd 和 useradd 一定要指定 -r,创建系统组和系统用户。
  2. +
  3. 创建用户时,一定要明确创建用户组 (-g),因为不同系统的默认组不一样!
  4. +
  5. 如果需要使用持久化卷,必须显式指明 gid 和 uid,因为不同系统为新用户分配的默认 gid 和 uid 都不一样!
  6. +
+

Debian/Ubuntu

1
2
3
root@debian-10:/# useradd -r user-01
root@debian-10:/# id user-01
uid=999(user-01) gid=999(user-01) groups=999(user-01)
+ +

RHEL/CentOS

1
2
3
[root@rhel-8 /]# useradd -r user-02
[root@rhel-8 /]# id user-02
uid=998(user-02) gid=996(user-02) groups=996(user-02)
+ +

SUSE

1
2
3
suse-15:/ # useradd -r user-03
suse-15:/ # id user-03
uid=499(user-03) gid=100(users) groups=100(users)
+ +

Alpine

1
2
3
/ # adduser -S user-04
/ # id user-04
uid=100(user-04) gid=65533(nogroup) groups=65533(nogroup),65533(nogroup)
+ +

目录与文件的权限

COPY and WORKDIR

使用 COPY 复制的文件和目录属主,以及 WORKDIR 创建的目录属主,与其与 USER 的相对位置无关,始终是 root ! +重申一次,WORKDIR 一定要事先创建,并且修改属主,不然其属主是 root ! +因此下面的例子看起来没错,实际不能正常写文件到当前目录:

+
1
2
3
4
5
6
FROM openjdk:8u242
RUN useradd -r monte
USER monte
COPY cassandra-table-cleanup.jar /var/lib/cassandra-table-cleanup/lib/
WORKDIR /var/lib/cassandra-table-cleanup/log/
CMD ["/usr/bin/java", "-jar", "/var/lib/cassandra-table-cleanup/lib/cassandra-table-cleanup.jar"]
+ +

chown

    +
  1. chown 不指定 group 时,不会修改 group 为 user 对应的 group !
  2. +
  3. chown 不使用递归选项 -R 时,子目录及其中的文件属主不会被改变。
  4. +
+
1
2
3
4
5
6
7
8
9
FROM openjdk:8u242

COPY cassandra-table-cleanup.jar /var/lib/cassandra-table-cleanup/lib/
RUN mkdir -p /var/lib/cassandra-table-cleanup/log/ && \
groupadd -r monte && useradd -r -g monte monte && \
chown -R monte:monte /var/lib/cassandra-table-cleanup
WORKDIR /var/lib/cassandra-table-cleanup/log/
USER monte
CMD ["/usr/bin/java", "-jar", "/var/lib/cassandra-table-cleanup/lib/cassandra-table-cleanup.jar"]
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/02/29/apt-configuration-and-preference/index.html b/2020/02/29/apt-configuration-and-preference/index.html new file mode 100644 index 00000000..d6531316 --- /dev/null +++ b/2020/02/29/apt-configuration-and-preference/index.html @@ -0,0 +1,217 @@ + + + + + + + + + + + + APT configuration and Preference | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ APT configuration and Preference +

+ +

APT configuration and Preference

APT configuration file

    +
  • /etc/apt/apt.conf
  • +
  • /etc/apt/apt.conf.d/
  • +
+
1
2
3
4
5
6
7
8
9
10
11
cat << EOF | sudo tee /etc/apt/apt.conf.d/zz-10-install
APT::Install-Recommends "0";
APT::Install-Suggests "0";

#Acquire::http { Proxy "http://www.example.com:8080"; };
#Acquire::http { Proxy "socks5h://127.0.0.1:10080"; };

Acquire::Languages "none";
Acquire::GzipIndexes "true";
Acquire::CompressionTypes::Order { "xz"; "gz"; };
EOF
+ +

APT Configuration Query program

1
apt-config dump
+ +

Preference control file for APT

    +
  • /etc/apt/preferences
  • +
  • /etc/apt/preferences.d/
  • +
+

stable

1
2
3
4
5
cat << EOF | sudo tee /etc/apt/preferences.d/10-stable
Package: *
Pin: release a=stable
Pin-Priority: 500
EOF
+ +

testing

1
2
3
4
5
cat << EOF | tee /etc/apt/preferences.d/20-testing
Package: *
Pin: release a=testing
Pin-Priority: 400
EOF
+ +

unstable

1
2
3
4
5
cat << EOF | tee /etc/apt/preferences.d/30-unstable
Package: *
Pin: release a=unstable
Pin-Priority: 90
EOF
+ +

experimental

1
2
3
4
5
cat << EOF | tee /etc/apt/preferences.d/40-experimental
Package: *
Pin: release a=experimental
Pin-Priority: 1
EOF
+ +

Shows available versions of installed packages

1
2
3
apt-get install -y --no-install-recommends apt-show-versions

apt-show-versions -u -b
+ +

Install/Upgrading Testing Packages

1
2
3
apt-get -t testing install nginx-full

apt-get install -y --no-install-recommends `apt-show-versions -u -b | grep testing`
+ +

Show policy settings

1
2
3
apt-cache policy wireguard-dkms

apt-get -t unstable install wireguard
+ +

List of configured APT data sources

    +
  • /etc/apt/sources.list
  • +
  • /etc/apt/sources.list.d
  • +
+
1
2
3
4
5
6
7
8
9
10
deb http://deb.debian.org/debian/ stable main contrib non-free
deb http://deb.debian.org/debian/ stable-updates main contrib non-free
deb http://deb.debian.org/debian/ stable-proposed-updates main contrib non-free
deb http://deb.debian.org/debian/ stable-backports main contrib non-free

deb http://deb.debian.org/debian/ testing main contrib non-free
deb http://deb.debian.org/debian/ testing-updates main contrib non-free
deb http://deb.debian.org/debian/ testing-proposed-updates main contrib non-free

deb http://deb.debian.org/debian/ unstable main contrib non-free
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/03/01/how-to-set-up-a-webdav-share-with-nginx/index.html b/2020/03/01/how-to-set-up-a-webdav-share-with-nginx/index.html new file mode 100644 index 00000000..a0e2b734 --- /dev/null +++ b/2020/03/01/how-to-set-up-a-webdav-share-with-nginx/index.html @@ -0,0 +1,201 @@ + + + + + + + + + + + + How to set up a WebDAV share with Nginx | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ How to set up a WebDAV share with Nginx +

+ +

How to set up a WebDAV share with Nginx

Built-in WebDAV Module

The ngx_http_dav_module module is intended for file management automation via the WebDAV protocol. The module processes HTTP and WebDAV methods PUT, DELETE, MKCOL, COPY, and MOVE.

+

WebDAV clients that require additional WebDAV methods to operate will not work with this module. Currently, only hdav of Haskell DAV library works.

+

nginx-dav.conf

1
2
3
4
5
6
7
8
9
10
11
12
13
location /dav {
root /var;

auth_basic WebDAV;
auth_basic_user_file /etc/nginx/.htpasswd;

dav_access user:rw group:rw all:r;
dav_methods PUT DELETE MKCOL COPY MOVE;

client_max_body_size 0;
create_full_put_path on;
client_body_temp_path /var/cache/nginx/client_temp 1 2 3;
}
+ +

hdav

1
2
3
4
sudo apt-get install -y --no-install-recommends hdav

hdav put testfile https://example.com/dav/testfile \
--username "${username}" --password "${password}"
+ +

WebDAV missing methods support for Nginx

Since both cadaver and davfs2 need methods OPTIONS and PROPFIND, we need ngx_dav_ext_module module for these missing methods.

+

nginx-dav-ext.conf

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# load_module modules/ngx_http_dav_ext_module.so;
# dav_ext_lock_zone zone=DAV:8m;
# dav_ext_lock zone=DAV;

location /dav {
root /var;

auth_basic WebDav;
auth_basic_user_file /etc/nginx/.htpasswd;

dav_access user:rw group:rw all:r;
dav_methods PUT DELETE MKCOL COPY MOVE;
dav_ext_methods PROPFIND OPTIONS LOCK UNLOCK;

client_max_body_size 0;
create_full_put_path on;
client_body_temp_path /var/cache/nginx/client_temp 1 2 3;
}
+ +

cadaver and davfs2

1
2
3
4
5
6
7
8
9
10
sudo apt-get install -y --no-install-recommends cadaver davfs2

sudo apt-get install -y --no-install-recommends -t testing nginx libnginx-mod-http-dav-ext

cadaver https://example.com/dav/

sudo mount -t davfs https://example.com/dav/ /mnt/

"DELETE /dav/xyz/ HTTP/1.1" 204 0 "-" "davfs2/1.5.5 neon/0.30.2"
"DELETE /dav/xyz/ HTTP/1.1" 204 0 "-" "cadaver/0.23.3 neon/0.30.2"
+ +

Windows 10 WebClient

Add support http in addition to https:

+
1
2
3
4
5
regedit HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WebClient\Parameters
BasicAuthLevel=2

net stop webclient
net start webclient
+ +

WebClient not good as hdav of Haskell DAV library, cadaver or davfs2. It has a lot of annoying problems and looks like a half-finished product.

+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/03/07/containers-for-development/index.html b/2020/03/07/containers-for-development/index.html new file mode 100644 index 00000000..a440a89c --- /dev/null +++ b/2020/03/07/containers-for-development/index.html @@ -0,0 +1,233 @@ + + + + + + + + + + + + Containers for development | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Containers for development +

+ +

Containers for development

Base images

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
docker pull alpine:3
docker pull debian:9
docker pull debian:10
docker pull ubuntu:18.04
docker pull ubuntu:20.04
docker pull centos:7
docker pull centos:8
docker pull registry.suse.com/suse/sles12sp5
docker pull registry.suse.com/suse/sle15
docker pull registry.access.redhat.com/ubi7/ubi
docker pull registry.access.redhat.com/ubi8/ubi
docker pull mcr.microsoft.com/windows/nanoserver:1809
docker pull mcr.microsoft.com/windows/nanoserver:1909
docker pull mcr.microsoft.com/windows/servercore:ltsc2019

docker image inspect alpine:3
"Created": "2020-01-18T01:19:37.187497623Z",
"Architecture": "amd64",
"Os": "linux",
"Size": 5591300,
+ +

SLE 15 based images

Java 8 - 8u242-jdk

Dockerfile

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
FROM registry.suse.com/suse/sle15

ARG JDK_8_URL="https://cdn.azul.com/zulu/bin/zulu8.44.0.11-ca-jdk8.0.242-linux_x64.tar.gz"
ARG MAVEN_URL="https://downloads.apache.org/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz"

WORKDIR /root

ENV \
LC_ALL="en_US.UTF-8" \
TZ="Asia/Shanghai" \
JAVA_HOME="/opt/jdk-8" \
PATH="/opt/maven/bin:/opt/jdk-8/bin:/usr/sbin:/usr/bin:/sbin:/bin"

RUN set -x \
&& zypper remove --no-confirm container-suseconnect || true \
&& zypper addrepo -C -G http://example.com/SLE15/SLE-15-SP1-Module-Basesystem/ SLE-15-SP1-Module-Basesystem \
&& zypper addrepo -C -G http://example.com/SLE15/SLE-15-SP1-Module-Basesystem-Updates/ SLE-15-SP1-Module-Basesystem-Updates \
&& zypper addrepo -C -G http://example.com/SLE15/SLE-15-SP1-Module-Development-Tools/ SLE-15-SP1-Module-Development-Tools \
&& zypper addrepo -C -G http://example.com/SLE15/SLE-15-SP1-Module-Development-Tools-Updates/ SLE-15-SP1-Module-Development-Tools-Updates \
&& zypper update --no-recommends --no-confirm \
&& zypper install --auto-agree-with-licenses --no-confirm --no-recommends timezone curl ca-certificates-mozilla gzip tar which \
&& zypper removerepo -a \
&& mkdir -p /opt/jdk-8 /opt/maven \
&& curl -sSL ${JDK_8_URL} | tar -C /opt/jdk-8 --strip-components=1 -xz \
&& curl -sSL ${MAVEN_URL} | tar -C /opt/maven --strip-components=1 -xz \
&& rm -fr /root/bin /opt/jdk-8/src.zip /opt/jdk-8/demo /opt/jdk-8/man /opt/jdk-8/sample \
&& mvn -version
+ +

docker build

1
2
3
4
5
6
7
8
9
10
IMG=songdongsheng/openjdk
TAG=8u242-jdk

docker build --compress --tag ${IMG}:${TAG} -f Dockerfile.8u242-jdk .

# docker image inspect ${IMG}:${TAG} | less

docker images | grep ${IMG}

docker push ${IMG}:${TAG}
+ +

Java 8 - 8u242-jre

Dockerfile

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
FROM registry.suse.com/suse/sle15

ARG JRE_8_URL="https://cdn.azul.com/zulu/bin/zulu8.44.0.11-ca-jre8.0.242-linux_x64.tar.gz"

WORKDIR /root

ENV \
LC_ALL="en_US.UTF-8" \
TZ="Asia/Shanghai" \
JAVA_HOME="/opt/jdk-8" \
PATH="/opt/maven/bin:/opt/jdk-8/bin:/usr/sbin:/usr/bin:/sbin:/bin"

RUN set -x \
&& zypper remove --no-confirm container-suseconnect || true \
&& zypper addrepo -C -G http://example.com/SLE15/SLE-15-SP1-Module-Basesystem/ SLE-15-SP1-Module-Basesystem \
&& zypper addrepo -C -G http://example.com/SLE15/SLE-15-SP1-Module-Basesystem-Updates/ SLE-15-SP1-Module-Basesystem-Updates \
&& zypper addrepo -C -G http://example.com/SLE15/SLE-15-SP1-Module-Development-Tools/ SLE-15-SP1-Module-Development-Tools \
&& zypper addrepo -C -G http://example.com/SLE15/SLE-15-SP1-Module-Development-Tools-Updates/ SLE-15-SP1-Module-Development-Tools-Updates \
&& zypper update --no-recommends --no-confirm \
&& zypper install --auto-agree-with-licenses --no-confirm --no-recommends timezone curl ca-certificates-mozilla gzip tar which \
&& zypper removerepo -a \
&& mkdir -p /opt/jdk-8 /opt/maven \
&& curl -sSL ${JRE_8_URL} | tar -C /opt/jdk-8 --strip-components=1 -xz \
&& rm -fr /root/bin /opt/jdk-8/src.zip /opt/jdk-8/demo /opt/jdk-8/man /opt/jdk-8/sample \
&& java -version
+ +

docker build

1
2
3
4
5
6
7
8
9
10
11
IMG=songdongsheng/openjdk
TAG=8u242-jre

docker build --compress --tag ${IMG}:${TAG} -f Dockerfile.8u242-jre .
docker tag ${IMG}:${TAG} ${IMG}

# docker image inspect ${IMG}:${TAG} | less

docker images | grep ${IMG}

docker push ${IMG}:${TAG}
+ + +

Java 11 - 11.0.6-jdk

Dockerfile

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
FROM registry.suse.com/suse/sle15

ARG JDK_11_URL="https://cdn.azul.com/zulu/bin/zulu11.37.17-ca-jdk11.0.6-linux_x64.tar.gz"
ARG MAVEN_URL="https://downloads.apache.org/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz"

WORKDIR /root

ENV \
LC_ALL="en_US.UTF-8" \
TZ="Asia/Shanghai" \
JAVA_HOME="/opt/jdk-11" \
PATH="/opt/maven/bin:/opt/jdk-11/bin:/usr/sbin:/usr/bin:/sbin:/bin"

RUN set -x \
&& zypper remove --no-confirm container-suseconnect || true \
&& zypper addrepo -C -G http://example.com/SLE15/SLE-15-SP1-Module-Basesystem/ SLE-15-SP1-Module-Basesystem \
&& zypper addrepo -C -G http://example.com/SLE15/SLE-15-SP1-Module-Basesystem-Updates/ SLE-15-SP1-Module-Basesystem-Updates \
&& zypper addrepo -C -G http://example.com/SLE15/SLE-15-SP1-Module-Development-Tools/ SLE-15-SP1-Module-Development-Tools \
&& zypper addrepo -C -G http://example.com/SLE15/SLE-15-SP1-Module-Development-Tools-Updates/ SLE-15-SP1-Module-Development-Tools-Updates \
&& zypper update --no-recommends --no-confirm \
&& zypper install --auto-agree-with-licenses --no-confirm --no-recommends timezone curl ca-certificates-mozilla gzip tar which \
&& zypper removerepo -a \
&& mkdir -p /opt/jdk-11 /opt/maven \
&& curl -sSL ${JDK_11_URL} | tar -C /opt/jdk-11 --strip-components=1 -xz \
&& curl -sSL ${MAVEN_URL} | tar -C /opt/maven --strip-components=1 -xz \
&& rm -fr /root/bin /opt/jdk-11/lib/src.zip /opt/jdk-11/demo /opt/jdk-11/man /opt/jdk-11/jmods \
&& mvn -version
+ +

docker build

1
2
3
4
5
6
7
8
9
10
IMG=songdongsheng/openjdk
TAG=11.0.6-jdk

docker build --compress --tag ${IMG}:${TAG} -f Dockerfile.11.0.6-jdk .

# docker image inspect ${IMG}:${TAG} | less

docker images | grep ${IMG}

docker push ${IMG}:${TAG}
+ +

Java 11 - 11.0.6-jre

Dockerfile

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
FROM registry.suse.com/suse/sle15

ARG JRE_11_URL="https://cdn.azul.com/zulu/bin/zulu11.37.17-ca-jre11.0.6-linux_x64.tar.gz"

WORKDIR /root

ENV \
LC_ALL="en_US.UTF-8" \
TZ="Asia/Shanghai" \
JAVA_HOME="/opt/jdk-11" \
PATH="/opt/jdk-11/bin:/usr/sbin:/usr/bin:/sbin:/bin"

RUN set -x \
&& zypper remove --no-confirm container-suseconnect || true \
&& zypper addrepo -C -G http://example.com/SLE15/SLE-15-SP1-Module-Basesystem/ SLE-15-SP1-Module-Basesystem \
&& zypper addrepo -C -G http://example.com/SLE15/SLE-15-SP1-Module-Basesystem-Updates/ SLE-15-SP1-Module-Basesystem-Updates \
&& zypper addrepo -C -G http://example.com/SLE15/SLE-15-SP1-Module-Development-Tools/ SLE-15-SP1-Module-Development-Tools \
&& zypper addrepo -C -G http://example.com/SLE15/SLE-15-SP1-Module-Development-Tools-Updates/ SLE-15-SP1-Module-Development-Tools-Updates \
&& zypper update --no-recommends --no-confirm \
&& zypper install --auto-agree-with-licenses --no-confirm --no-recommends timezone curl ca-certificates-mozilla gzip tar which \
&& zypper removerepo -a \
&& mkdir -p /opt/jdk-11 \
&& curl -sSL ${JRE_11_URL} | tar -C /opt/jdk-11 --strip-components=1 -xz \
&& rm -fr /root/bin /opt/jdk-11/man \
&& java -version
+ +

docker build

1
2
3
4
5
6
7
8
9
10
11
IMG=songdongsheng/openjdk
TAG=11.0.6-jre

docker build --compress --tag ${IMG}:${TAG} -f Dockerfile.11.0.6-jre .
# docker tag ${IMG}:${TAG} ${IMG}

# docker image inspect ${IMG}:${TAG} | less

docker images | grep ${IMG}

docker push ${IMG}:${TAG}
+ +

Ubuntu 18.04 based images

All in one

Dockerfile

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
FROM ubuntu:18.04

ARG NODE_JS_12_URL="https://nodejs.org/dist/v12.16.1/node-v12.16.1-linux-x64.tar.xz"
ARG JDK_11_URL="https://cdn.azul.com/zulu/bin/zulu11.37.17-ca-jdk11.0.6-linux_x64.tar.gz"
ARG JDK_8_URL="https://cdn.azul.com/zulu/bin/zulu8.44.0.11-ca-jdk8.0.242-linux_x64.tar.gz"
ARG MAVEN_URL="https://downloads.apache.org/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz"
ARG JRUBY_URL="https://github.com/jruby/jruby/releases/download/9.2.11.0/jruby-dist-9.2.11.0-bin.tar.gz"

WORKDIR /root

ENV \
LC_ALL="en_US.UTF-8" \
TZ="Asia/Shanghai" \
TERM="tmux-256color" \
PATH="/opt/node-v12/bin:/opt/jruby/bin:/opt/maven/bin:/opt/jdk-11/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

RUN set -x \
&& apt-get update \
&& apt-get install -y --no-install-recommends dialog locales \
&& localedef -i en_US -f UTF-8 -A /etc/locale.alias en_US.UTF-8 \
&& localedef --list-archive \
&& apt-get dist-upgrade -y --no-install-recommends \
&& apt-get install -y --no-install-recommends curl ca-certificates xz-utils python3-distutils \
&& mkdir -p /opt/node-v12 /opt/jruby /opt/maven /opt/jdk-11 \
&& curl -sSL ${JDK_11_URL} | tar -C /opt/jdk-11 --strip-components=1 -xz \
&& curl -sSL ${MAVEN_URL} | tar -C /opt/maven --strip-components=1 -xz \
&& curl -sSL ${JRUBY_URL} | tar -C /opt/jruby --strip-components=1 -xz \
&& curl -sSL ${NODE_JS_12_URL} | tar -C /opt/node-v12 --strip-components=1 -xJ \
&& curl -sSL https://bootstrap.pypa.io/get-pip.py | python3 \
&& python3 -m pip install -U Pygments docutils PyYAML simplejson lxml requests pyOpenSSL cassandra-driver aioredis redis-py-cluster recommonmark confluent-kafka asyncpg pg8000 mysql-connector-python \
&& gem install asciidoctor asciidoctor-diagram asciidoctor-pdf asciimath pygments.rb rouge kramdown-asciidoc \
&& gem sources -c \
&& apt-get clean && rm -rf /var/lib/apt/lists/* \
&& python3 -m pip list --format=columns \
&& mvn -version \
&& jruby --version \
&& npm version
+ +

docker build

1
2
3
4
5
6
7
8
9
10
IMG=songdongsheng/development
TAG=20200307

docker build --tag ${IMG}:${TAG} .

# docker image inspect ${IMG}:${TAG} | less

docker images | grep ${IMG}

docker push ${IMG}:${TAG}
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/03/08/synchronization-of-linux-clocks/index.html b/2020/03/08/synchronization-of-linux-clocks/index.html new file mode 100644 index 00000000..3c39c47b --- /dev/null +++ b/2020/03/08/synchronization-of-linux-clocks/index.html @@ -0,0 +1,257 @@ + + + + + + + + + + + + Synchronization of Linux clocks | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Synchronization of Linux clocks +

+ +

Synchronization of computer clocks by NTP and PTP

There are two supported protocols for synchronization of computer clocks over a network. The older and more well-known protocol is the Network Time Protocol (NTP). In its fourth version, NTP is defined by IETF in RFC 5905. The newer protocol is the Precision Time Protocol (PTP), which is defined in the IEEE 1588-2008 standard.

+

The reference implementation of NTP is provided in the ntp package. +chrony is a more versatile NTP implementation, which can usually synchronize the clock with better accuracy and has other advantages over the reference implementation. PTP is implemented in the linuxptp package.

+

PTP was designed for local networks with broadcast/multicast transmission and, in ideal conditions, the system clock can be synchronized with sub-microsecond accuracy to the reference time. NTP was primarily designed for synchronization over the Internet using unicast, where it can usually achieve accuracy in the single-digit millisecond range.

+

The basic principles of the two protocols are the same. Computers or other devices that have a clock are connected in a network and form a hierarchy of time sources in which time is distributed from top to bottom. The devices on top are normally synchronized to a reference time source (e.g. a timing signal from a GPS receiver). Devices “below” periodically exchange timestamps with their time sources in order to measure the offset of their clocks. The clocks are continuously adjusted to correct for random variations in their rate (due to effects like thermal changes) and to minimize the observed offset.

+

In NTP, one level of the hierarchy is called stratum. The devices on top are stratum 1 servers, below them are stratum 2 clients, which are servers to stratum 3 clients, and so on. In PTP there are slaves, which are synchronized to their masters. Each communication path has one master and its slaves can be masters on other communication paths. The master on top is called grandmaster (GM). A device that has ports in two or more communication paths (i.e. it can be a slave and also master of other slaves at the same time) is a boundary clock (BC). Clocks with one port are ordinary clocks (OC). The group of all clocks that are directly or indirectly synchronized to each other using the protocol is called a PTP domain.

+

Combining PTP with NTP

In order to get both accuracy and resiliency at the same time, it would be useful if PTP and NTP could be combined. PTP would be the primary source for synchronization of the clock when everything is working as expected. NTP would keep the PTP sources in check and allow for fallback between different PTP sources, or to NTP servers when all PTP sources fail.

+

/etc/linuxptp/timemaster.conf

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
[ptp_domain 0]
interfaces ens3
delay 10e-6

#[ptp_domain 1]
#interfaces eth1
#delay 10e-6

[ntp_server us.pool.ntp.org]
minpoll 3
maxpoll 15
iburst 1

[ntp_server ca.pool.ntp.org]
minpoll 3
maxpoll 15
iburst 1

[ntp_server de.pool.ntp.org]
minpoll 3
maxpoll 15
iburst 1

[timemaster]
ntp_program chronyd
+ +

Verification

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# apt-get install -y linuxptp
# dpkg -L linuxptp | sort | less
/etc/linuxptp/ptp4l.conf
/etc/linuxptp/timemaster.conf
/lib/systemd/system/ptp4l.service
/lib/systemd/system/timemaster.service
/usr/sbin/ptp4l
/usr/sbin/timemaster
/var/run/timemaster

# ptp4l -i ens3 -m -H
# ptp4l -i ens3 -m -S

# phc_ctl /dev/ptp0
# phc_ctl /dev/ptp0 get
# phc_ctl /dev/ptp0 cmp

# /usr/sbin/timemaster -f /etc/linuxptp/timemaster.conf -m -l 7 -n

# systemctl start timemaster && systemctl status timemaster -l --no-pager

# pmc -u -b 0 'GET CURRENT_DATA_SET'
# pmc -u -b 0 'GET TIME_STATUS_NP'

# chronyc sources
# chronyc -n tracking

# ethtool -T ens3
Time stamping parameters for ens3:
Capabilities:
software-transmit (SOF_TIMESTAMPING_TX_SOFTWARE)
software-receive (SOF_TIMESTAMPING_RX_SOFTWARE)
software-system-clock (SOF_TIMESTAMPING_SOFTWARE)
PTP Hardware Clock: none
Hardware Transmit Timestamp Modes: none
Hardware Receive Filter Modes: none
+ +

Virtual PTP hardware clock (PHC)

Virtual network devices in KVM guests do not support hardware timestamping, which means it is difficult to synchronize the clocks of guests that use a network protocol like NTP or PTP with better accuracy than tens of microseconds.

+

When a more accurate synchronization of the guests is required, it is recommended to synchronize the clock of the host using NTP or PTP with hardware timestamping, and to synchronize the guests to the host directly. Linux KVM provide a virtual PTP hardware clock (PHC), which enables the guests to synchronize to the host with a sub-microsecond accuracy.

+

ptp_kvm

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# modinfo ptp_kvm
filename: /lib/modules/5.4.0-4-amd64/kernel/drivers/ptp/ptp_kvm.ko
license: GPL
description: PTP clock using KVMCLOCK
author: Marcelo Tosatti <mtosatti@redhat.com>
depends: ptp

# modprobe ptp_kvm
[31918.515562] pps_core: LinuxPPS API ver. 1 registered
[31918.515575] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[31918.516788] PTP clock support registered

# echo ptp_kvm > /etc/modules-load.d/ptp_kvm.conf
# echo "refclock PHC /dev/ptp0 poll 2" >> /etc/chrony.conf
# systemctl restart chronyd
# chronyc sources
+ +

/etc/chrony/chrony.conf

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
keyfile /etc/chrony/chrony.keys
driftfile /var/lib/chrony/chrony.drift
logdir /var/log/chrony

maxupdateskew 100.0
makestep 1 3
rtcsync

leapsecmode slew
maxslewrate 1000
smoothtime 400 0.001 leaponly

# PTP hardware clock (PHC) driver
refclock PHC /dev/ptp0 poll 2 trust

pool de.pool.ntp.org iburst maxsources 2 minpoll 3 maxpoll 15
pool us.pool.ntp.org iburst maxsources 2 minpoll 3 maxpoll 15
pool fr.pool.ntp.org iburst maxsources 2 minpoll 3 maxpoll 15
pool uk.pool.ntp.org iburst maxsources 2 minpoll 3 maxpoll 15
pool nl.pool.ntp.org iburst maxsources 2 minpoll 3 maxpoll 15
pool ru.pool.ntp.org iburst maxsources 2 minpoll 3 maxpoll 15
pool ca.pool.ntp.org iburst maxsources 2 minpoll 3 maxpoll 15
+ +

Verification

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# apt-get install -y chrony

# chronyd -f /etc/chrony/chrony.conf -d -Q

# systemctl restart chronyd && systemctl status chronyd --no-pager

# chronyc -n tracking
Reference ID : 50484330 (PHC0)
Stratum : 1
Ref time (UTC) : Tue Mar 17 05:01:01 2020
System time : 0.000000001 seconds slow of NTP time
Last offset : -0.000000001 seconds
RMS offset : 0.000000024 seconds
Frequency : 1.393 ppm slow
Residual freq : -0.000 ppm
Skew : 0.001 ppm
Root delay : 0.000000001 seconds
Root dispersion : 0.000004307 seconds
Update interval : 4.0 seconds
Leap status : Normal

# chronyc -n sources

210 Number of sources = 15
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
#* PHC0 0 2 377 5 +1ns[ -1ns] +/- 23ns
^- 185.244.195.159 3 8 377 229 -1259us[-1257us] +/- 104ms
^- 193.30.35.11 2 8 377 230 +2118us[+2120us] +/- 113ms
^- 216.229.0.50 2 8 377 228 +1084us[+1086us] +/- 44ms
^- 96.245.170.99 2 8 377 31 -159us[ -159us] +/- 132ms
^- 212.83.145.32 3 7 377 53 -55us[ -55us] +/- 97ms
^- 37.187.2.230 3 8 377 227 +793us[ +795us] +/- 101ms
^- 195.219.205.9 2 8 377 227 +1867us[+1869us] +/- 93ms
^- 178.62.16.103 2 8 377 230 +572us[ +574us] +/- 87ms
^- 5.200.6.34 2 4 377 3 -62ms[ -62ms] +/- 184ms
^- 5.39.184.5 2 8 377 99 -407us[ -407us] +/- 90ms
^- 85.21.78.91 2 8 377 118 +290us[ +291us] +/- 112ms
^- 91.207.136.55 2 8 377 229 -1403us[-1401us] +/- 143ms
^- 192.99.2.172 2 8 377 29 +1033us[+1033us] +/- 37ms
^- 216.197.156.83 1 7 377 18 +11ms[ +11ms] +/- 51ms
+ +

Protocol dependencies

PTP

    +
  • UDP: Typically, PTP uses UDP as its transport protocol (although other transport protocols are possible). The well known UDP ports for PTP traffic are 319 (Event Message) and 320 (General Message).
  • +
  • Ethernet: Starting with IEEE1588 Version2, a native Layer2 Ethernet implementation was designed. PTP can use Ethernet as its transport protocol. The well known Ethernet type for PTP traffic is 0x88F7.
  • +
+
1
tcpdump -vv -i ens3 "(ether proto 0x88F7) or (udp port 319 or udp port 320)"
+ +

NTP

NTP is a UDP-based service. NTP servers use well-known port 123 to talk to each other and to NTP clients. NTP clients use random ports above 1023.

+
1
tcpdump -vv -i any "udp port 123"
+ +

Summary

Here is an overview of main features that are currently specified in the protocols and that have an effect on accuracy, resiliency, or security:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
featuresNTPPTP
Delay correctionNoYes
Transmit timestamp correctionNoYes
Client-side source selectionYesNo
Multiple sourcesYesNo
Estimation of maximum errorYesNo
AuthenticationYesExperimental
+

Both NTP and PTP have some strong advantages over the other. PTP in ideal conditions with HW timestamping and transparent clocks can effectively eliminate the effect of the network on the measurements and synchronize the system clock with sub-microsecond accuracy. NTP is highly resilient. It works with multiple sources, estimates their errors, and selects only good sources for synchronization.

+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/03/14/synchronization-of-windows-clocks/index.html b/2020/03/14/synchronization-of-windows-clocks/index.html new file mode 100644 index 00000000..4b4ed068 --- /dev/null +++ b/2020/03/14/synchronization-of-windows-clocks/index.html @@ -0,0 +1,218 @@ + + + + + + + + + + + + Synchronization of Windows Clocks | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Synchronization of Windows Clocks +

+ +

Synchronization of Windows Clocks

Windows 可以使用 NTP 作为时间输入源,运行在虚拟机上时还可以使用 VMIC (Virtual Machine Integration Components) 时间输入源。 +从 Windows 10 1809 或 Windows Server 2019 开始,可以使用 PTP 作为时间输入源。

+
    +
  • PTP: %SystemRoot%\System32\ptpprov.dll
  • +
  • NTP: %SystemRoot%\System32\w32time.dll
  • +
  • VMIC: %SystemRoot%\System32\vmictimeprovider.dll
  • +
+
1
2
3
4
5
6
C:\>reg query HKLM\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpClient
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpServer
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\PtpClient
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\VMICTimeProvider
+ +

Initialization

当 Windows Time Service 不能正常工作时,可以重新注册这个服务。

+
1
2
3
4
net stop w32time
W32tm /unregister
W32tm /register
net start w32time
+ +

Configuration

+

NTP

常用的 Windows Time Service 的注册表配置项如下:

+
1
2
3
4
5
6
7
8
9
10
11
12
13
reg add HKLM\SYSTEM\CurrentControlSet\Services\W32Time\Config /t REG_DWORD /v AnnounceFlags /d 10 /f
reg add HKLM\SYSTEM\CurrentControlSet\Services\W32Time\Config /t REG_DWORD /v EventLogFlags /d 3 /f
reg add HKLM\SYSTEM\CurrentControlSet\Services\W32Time\Config /t REG_DWORD /v MinPollInterval /d 4 /f
reg add HKLM\SYSTEM\CurrentControlSet\Services\W32Time\Config /t REG_DWORD /v MaxPollInterval /d 6 /f

reg add HKLM\SYSTEM\CurrentControlSet\Services\W32Time\Parameters /t REG_SZ /v Type /d NTP /f
reg add HKLM\SYSTEM\CurrentControlSet\Services\W32Time\Parameters /t REG_SZ /v NtpServer /d "time.windows.com,0x9 de.pool.ntp.org,0x9 us.pool.ntp.org,0x9 jp.pool.ntp.org,0x9" /f

reg add HKLM\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpClient /t REG_DWORD /v Enabled /d 1 /f
reg add HKLM\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpClient /t REG_EXPAND_SZ /v DllName /d "%SystemRoot%\System32\w32time.dll" /f
reg add HKLM\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpClient /t REG_EXPAND_SZ /v DllName /d "C:\WINDOWS\SYSTEM32\w32time.DLL" /f
reg add HKLM\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpClient /t REG_DWORD /v EventLogFlags /d 3 /f
reg add HKLM\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpClient /t REG_DWORD /v InputProvider /d 1 /f
+ +

也可以这样配置 NTP 服务器:

+
1
2
w32tm /config /manualpeerlist:"time.windows.com,0x9 de.pool.ntp.org,0x9 us.pool.ntp.org,0x9 jp.pool.ntp.org,0x9" /syncfromflags:manual /update
net stop w32time && net start w32time
+ +

PTP

1
2
3
4
5
6
reg add HKLM\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\PtpClient /t REG_SZ /v PtpMasters /d "10.10.10.10 10.10.10.11" /f
reg add HKLM\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\PtpClient /t REG_DWORD /v Enabled /d 1 /f
reg add HKLM\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\PtpClient /t REG_DWORD /v InputProvider /d 1 /f
reg add HKLM\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\PtpClient /t REG_EXPAND_SZ /v DllName /d "%SystemRoot%\System32\ptpprov.dll" /f
reg add HKLM\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\PtpClient /t REG_DWORD /v DelayPollInterval /d 0x3e80 /f
reg add HKLM\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\PtpClient /t REG_DWORD /v AnnounceInterval /d 0x0fa0 /f
+ +

Workaround of VM time out of sync

1
2
Get-VMIntegrationService -VMName DockerDesktopVM -Name "Time Synchronization" | Disable-VMIntegrationService
Get-VMIntegrationService -VMName DockerDesktopVM -Name "Time Synchronization" | Enable-VMIntegrationService
+ +

Tools

Query

1
2
3
4
w32tm /query /configuration
w32tm /query /status /verbose
w32tm /query /source
w32tm /query /peers
+ +

Resynchronization

1
w32tm /resync
+ +

Offset measurement

1
2
w32tm /stripchart /rdtsc /computer:0.pool.ntp.org /samples:5
w32tm /stripchart /rdtsc /computer:time.windows.com /samples:5
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/03/15/vultr-api-quickstart/index.html b/2020/03/15/vultr-api-quickstart/index.html new file mode 100644 index 00000000..5fe30a51 --- /dev/null +++ b/2020/03/15/vultr-api-quickstart/index.html @@ -0,0 +1,252 @@ + + + + + + + + + + + + Vultr API Quickstart | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Vultr API Quickstart +

+ +

Vultr API Quickstart

Overview

    +
  • API Endpoint: https://api.vultr.com/

    +
  • +
  • Available in Members Area

    +
  • +
  • Authentication: For any API request that requires authentication, you would need to send the ‘API-Key: YOURKEY’ HTTP header. See the cURL examples below for more information on how to do this.

    +
  • +
  • Time and Date: All time and date fields returned by this API are displayed in UTC.

    +
  • +
  • HTTP Response Codes:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    HTTP Response CodeDescription
    200Function successfully executed.
    400Invalid API location. Check the URL that you are using.
    403Invalid or missing API key. Check that your API key is present and matches your assigned key.
    405Invalid HTTP method. Check that the method (POST
    412Request failed. Check the response body for a more detailed description.
    500Internal server error. Try again at a later time.
    503Rate limit hit. API requests are limited to an average of 2/s. Try your request again later.
    +
  • +
+

Retrieve a list of all active regions

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# curl -sSL https://api.vultr.com/v1/regions/list | jq .
{
"5": {
"DCID": "5",
"name": "Los Angeles",
"country": "US",
"continent": "North America",
"state": "CA",
"ddos_protection": true,
"block_storage": false,
"regioncode": "LAX"
},
"6": {
"DCID": "6",
"name": "Atlanta",
"country": "US",
"continent": "North America",
"state": "GA",
"ddos_protection": false,
"block_storage": false,
"regioncode": "ATL"
},
"19": {
"DCID": "19",
"name": "Sydney",
"country": "AU",
"continent": "Australia",
"state": "",
"ddos_protection": false,
"block_storage": false,
"regioncode": "SYD"
}
}
+ +

Retrieve a list of all active plans

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# curl -sSL https://api.vultr.com/v1/plans/list_vc2 | jq .
{
"201": {
"VPSPLANID": "201",
"name": "1024 MB RAM,25 GB SSD,1.00 TB BW",
"vcpu_count": "1",
"ram": "1024",
"disk": "25",
"bandwidth": "1.00",
"bandwidth_gb": "1024",
"price_per_month": "5.00",
"plan_type": "SSD"
},
"208": {
"VPSPLANID": "208",
"name": "98304 MB RAM,1600 GB SSD,15.00 TB BW",
"vcpu_count": "24",
"ram": "98304",
"disk": "1600",
"bandwidth": "15.00",
"bandwidth_gb": "15360",
"price_per_month": "640.00",
"plan_type": "SSD"
}
}

# curl -sSL https://api.vultr.com/v1/plans/list_vc2z | jq .
{
"400": {
"VPSPLANID": "400",
"name": "1024 MB RAM,32 GB SSD,1.00 TB BW",
"vcpu_count": "1",
"ram": "1024",
"disk": "32",
"bandwidth": "1.00",
"bandwidth_gb": "1024",
"price_per_month": "6.00",
"plan_type": "HIGHFREQUENCY"
},
"406": {
"VPSPLANID": "406",
"name": "49152 MB RAM,768 GB SSD,8.00 TB BW",
"vcpu_count": "12",
"ram": "49152",
"disk": "768",
"bandwidth": "8.00",
"bandwidth_gb": "8192",
"price_per_month": "256.00",
"plan_type": "HIGHFREQUENCY"
}
}

# curl -sSL "https://api.vultr.com/v1/plans/list?type=vc2z" | jq .
{
"400": {
"VPSPLANID": "400",
"name": "1024 MB RAM,32 GB SSD,1.00 TB BW",
"vcpu_count": "1",
"ram": "1024",
"disk": "32",
"bandwidth": "1.00",
"bandwidth_gb": "1024",
"price_per_month": "6.00",
"plan_type": "HIGHFREQUENCY",
"available_locations": [1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 19, 22, 24, 25, 39, 40]
},
"406": {
"VPSPLANID": "406",
"name": "49152 MB RAM,768 GB SSD,8.00 TB BW",
"vcpu_count": "12",
"ram": "49152",
"disk": "768",
"bandwidth": "8.00",
"bandwidth_gb": "8192",
"price_per_month": "256.00",
"plan_type": "HIGHFREQUENCY",
"available_locations": []
}
}
+ +

Retrieve a list of the VPSPLANIDs currently available in this location

1
2
# curl -sSL "https://api.vultr.com/v1/regions/availability?DCID=1" | jq .
[201, 202, 203, 204, 205, 206, 115, 116, 117, 400, 401, 402, 403, 404, 405, 29, 93, 94, 95, 96, 97, 98, 100]
+ +

Retrieve a list of available operating systems

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# curl -sSL https://api.vultr.com/v1/os/list | jq .
{
"270": {
"OSID": 270,
"name": "Ubuntu 18.04 x64",
"arch": "x64",
"family": "ubuntu"
},
"327": {
"OSID": 327,
"name": "FreeBSD 12 x64",
"arch": "x64",
"family": "freebsd"
},
"352": {
"OSID": 352,
"name": "Debian 10 x64 (buster)",
"arch": "x64",
"family": "debian"
},
"362": {
"OSID": 362,
"name": "CentOS 8 x64",
"arch": "x64",
"family": "centos",
"windows": false
},
"366": {
"OSID": 366,
"name": "OpenBSD 6.6 x64",
"arch": "x64",
"family": "openbsd"
}
}
+ +

Create a new virtual machine

1
2
3
4
# curl -sSL -H "API-Key: ${VULTR_API_KEY}" https://api.vultr.com/v1/server/create --data 'DCID=1' --data 'VPSPLANID=400' --data 'OSID=352'
{
"SUBID": "1312965"
}
+ +

List all active or pending virtual machines

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# curl -sSL -H "API-Key: ${VULTR_API_KEY}" https://api.vultr.com/v1/server/list | jq .
{
"576965": {
"SUBID": "576965",
"os": "Debian 10 x64 (buster)",
"ram": "1024 MB",
"disk": "Virtual 32 GB",
"main_ip": "123.123.123.123",
"vcpu_count": "1",
"location": "Los Angeles",
"DCID": "5",
"default_password": "o6%$#6xf!ekUD",
"date_created": "2013-12-19 14:45:41",
"pending_charges": "0.18",
"status": "active",
"cost_per_month": "6.00",
"current_bandwidth_gb": 6.58,
"allowed_bandwidth_gb": "1000",
"netmask_v4": "255.255.255.248",
"gateway_v4": "123.123.123.1",
"power_status": "running",
"server_state": "ok",
"VPSPLANID": "400",
"v6_main_ip": "2001:DB8:1000::100",
"v6_network_size": "64",
"v6_network": "2001:DB8:1000::",
"v6_networks": [
{
"v6_network": "2001:DB8:1000::",
"v6_main_ip": "2001:DB8:1000::100",
"v6_network_size": "64"
}
],
"label": "vultr-lax-ca-us-02",
"internal_ip": "10.99.0.10",
"kvm_url": "https://my.vultr.com/subs/vps/novnc/api.php?data=djJ8dngxTmFh-tT8qW56h",
"auto_backups": "no",
"tag": "mytag",
"OSID": "352",
"APPID": "0",
"FIREWALLGROUPID": "0"
}
}
+ + +

Destroy (delete) a virtual machine

1
2
3
4
5
6
# curl -sSL -i -H "API-Key: ${VULTR_API_KEY}" https://api.vultr.com/v1/server/destroy --data 'SUBID=1312965'

HTTP/2 412
content-type: text/html; charset=UTF-8

Invalid server. Check SUBID value and ensure your API key matches the server's account
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/03/21/get-started-flyway-in-5-minutes/index.html b/2020/03/21/get-started-flyway-in-5-minutes/index.html new file mode 100644 index 00000000..4489c2c9 --- /dev/null +++ b/2020/03/21/get-started-flyway-in-5-minutes/index.html @@ -0,0 +1,217 @@ + + + + + + + + + + + + Get Started Flyway in 5 minutes | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Get Started Flyway in 5 minutes +

+ +

Get Started Flyway in 5 minutes

    +
  • install the Flyway Command-line tool
  • +
  • configure it so it can talk to our database
  • +
  • write our first couple of migrations
  • +
+

Downloading and extracting Flyway

+

Prepare the database

1
2
3
4
5
6
7
8
-- DROP ROLE pcc;
CREATE ROLE pcc LOGIN PASSWORD 'pcc'
SUPERUSER INHERIT CREATEDB CREATEROLE REPLICATION;

-- DROP DATABASE pcc;
CREATE DATABASE pcc
WITH OWNER = pcc
ENCODING = 'UTF-8';
+ +

Configuring Flyway

vi conf/flyway.conf

+
1
2
3
4
# single-schema mode
flyway.url=jdbc:postgresql://localhost:5432/pcc
flyway.user=pcc
flyway.password=pcc
+ +

Creating the first migration

vi sql/V1__Create_person_table.sql

+
1
2
3
4
5
CREATE TABLE person (
id integer NOT NULL,
name varchar(100) NOT NULL,
PRIMARY KEY (id)
);
+ +

Migrating the database

1
2
3
4
5
6
7
8
9
# flyway migrate

Flyway Community Edition 6.3.2 by Redgate
Database: jdbc:postgresql://localhost:5432/pcc (PostgreSQL 12.1)
Successfully validated 1 migration (execution time 00:00.022s)
Creating Schema History table "public"."flyway_schema_history" ...
Current version of schema "public": << Empty Schema >>
Migrating schema "public" to version 1 - Create person table
Successfully applied 1 migration to schema "public" (execution time 00:00.068s)
+ +

Adding a second migration

vi sql/V2__Add_people.sql

+
1
2
3
INSERT INTO person (id, name) VALUES (1, 'Axel');
INSERT INTO person (id, name) VALUES (2, 'Mr. Foo');
INSERT INTO person (id, name) VALUES (3, 'Ms. Bar');
+ +

Migrating the database again

1
2
3
4
5
6
7
# flyway migrate
Flyway Community Edition 6.3.2 by Redgate
Database: jdbc:postgresql://localhost:5432/pcc (PostgreSQL 12.1)
Successfully validated 2 migrations (execution time 00:00.065s)
Current version of schema "public": 1
Migrating schema "public" to version 2 - Add people
Successfully applied 1 migration to schema "public" (execution time 00:00.106s)
+ +

Flyway schema history table

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# \d flyway_schema_history
Table "public.flyway_schema_history"
Column | Type | Collation | Nullable | Default
----------------+-----------------------------+-----------+----------+---------
installed_rank | integer | | not null |
version | character varying(50) | | |
description | character varying(200) | | not null |
type | character varying(20) | | not null |
script | character varying(1000) | | not null |
checksum | integer | | |
installed_by | character varying(100) | | not null |
installed_on | timestamp without time zone | | not null | now()
execution_time | integer | | not null |
success | boolean | | not null |
Indexes:
"flyway_schema_history_pk" PRIMARY KEY, btree (installed_rank)
"flyway_schema_history_s_idx" btree (success)
+ +
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
CREATE TABLE flyway_schema_history
(
installed_rank integer NOT NULL,
version character varying(50),
description character varying(200) NOT NULL,
type character varying(20) NOT NULL,
script character varying(1000) NOT NULL,
checksum integer,
installed_by character varying(100) NOT NULL,
installed_on timestamp without time zone NOT NULL DEFAULT now(),
execution_time integer NOT NULL,
success boolean NOT NULL,
CONSTRAINT flyway_schema_history_pk PRIMARY KEY (installed_rank)
);

-- DROP INDEX flyway_schema_history_s_idx;
CREATE INDEX flyway_schema_history_s_idx
ON flyway_schema_history USING btree
(success ASC NULLS LAST);
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/03/22/net-core-life-cycle/index.html b/2020/03/22/net-core-life-cycle/index.html new file mode 100644 index 00000000..ebcc5d03 --- /dev/null +++ b/2020/03/22/net-core-life-cycle/index.html @@ -0,0 +1,418 @@ + + + + + + + + + + + + .NET Core Life Cycle | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ .NET Core Life Cycle +

+ +

.NET Core Life Cycle

.NET Programming Languages

.NET is a free, cross-platform, open source developer platform, created by Microsoft, for building many different types of applications. With .NET, you can use multiple languages, editors, and libraries to build for web, mobile, desktop, gaming, and IoT. You can write your .NET apps in C#, F#, or Visual Basic. Supported on Windows, Linux, and macOS.

+

LTS and Current with .NET Core

.NET Core gives two support options: Long Term Support (LTS) and Current. .NET Core adapted behaviors similar with other open source frameworks and platforms.

+

Long-term support (LTS) releases have an extended support period. Use LTS if you need to stay supported on the same version of .NET Core for longer.

+

LTS is supported for one of these two options – whatever is shorter:

+
    +
  • 3 years after its release or
  • +
  • 12 months after the next LTS version
  • +
+

Current is supported for one of these three options – whatever is shorter:

+
    +
  • 12 months after the next LTS version or
  • +
  • 3 months after the next Current version
  • +
+

.NET Core release lifecycles

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
VERSIONRELEASE DATESUPPORT LEVELEND OF SUPPORT
.NET Core 3.12019-12-03LTSDecember 3, 2022
.NET Core 3.02019-09-23Current (EOL)March 3, 2020
.NET Core 2.22018-12-04Current (EOL)December 23, 2019
.NET Core 2.12018-05-30LTSAugust 21, 2021
+

Download .NET Core

+

The ASP.NET Core Module is a native IIS module that plugs into the IIS pipeline to either:

+
    +
  • Host an ASP.NET Core app inside of the IIS worker process (w3wp.exe), called the in-process hosting model.
  • +
  • Forward web requests to a backend ASP.NET Core app running the Kestrel server, called the out-of-process hosting model.
  • +
+ + + + + + + + + + + + + + + + + + + + + + + +
INTENTIONOPTION
build applications.NET SDK
console applications.NET Core Runtime
desktop applications.NET Desktop Runtime
web/server applicationsASP.NET Core Runtime
+

.NET Core 3.1

+

Language support

    +
  • C# 8.0
  • +
  • F# 4.7
  • +
+

Supported OS versions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
OSVersionArchitecturesNotes
Windows 10 ClientVersion 1607+x64, x86
Nano ServerVersion 1803+x64, ARM32
Windows Server2012 R2+x64, x86
Mac OS X10.13+x64
Red Hat Enterprise Linux
CentOS
Oracle Linux
7+x64
Debian9+x64, ARM32, ARM64
Ubuntu18.04, 16.04x64, ARM32, ARM64
SUSE Enterprise Linux (SLES)12 SP2+x64
Alpine Linux3.8+x64, ARM64
+

.NET Core 5.0

+

Language support

    +
  • C# 8.0
  • +
  • F# 5.0
  • +
+

Supported OS versions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
OSVersionArchitecturesNotes
Windows 10 ClientVersion 1607+x64, x86
Nano ServerVersion 1803+x64, ARM32
Windows Server2012 R2+x64, x86
Mac OS X10.13+x64
Red Hat Enterprise Linux
CentOS
Oracle Linux
7+x64
Debian9+x64, ARM32, ARM64
Ubuntu18.04, 16.04x64, ARM32, ARM64
SUSE Enterprise Linux (SLES)12 SP2+x64
Alpine Linux3.8+x64, ARM64
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/03/28/performance-of-zookeeper-lock/index.html b/2020/03/28/performance-of-zookeeper-lock/index.html new file mode 100644 index 00000000..cacf5692 --- /dev/null +++ b/2020/03/28/performance-of-zookeeper-lock/index.html @@ -0,0 +1,246 @@ + + + + + + + + + + + + Performance of ZooKeeper Lock | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Performance of ZooKeeper Lock +

+ +

Performance of ZooKeeper Lock

ZooKeeper Locks

Fully distributed locks that are globally synchronous, meaning at any snapshot in time no two clients think they hold the same lock. These can be implemented using ZooKeeeper. As with priority queues, first define a lock node.

+

Note:

+
+

There now exists a Lock implementation in ZooKeeper recipes directory. This is distributed with the release – zookeeper-recipes/zookeeper-recipes-lock directory of the release artifact.

+
+

Clients wishing to obtain a lock do the following:

+
    +
  1. Call create( ) with a pathname of “locknode/guid-lock-“ and the sequence and ephemeral flags set. The guid is needed in case the create() result is missed. See the note below.
  2. +
  3. Call getChildren( ) on the lock node without setting the watch flag (this is important to avoid the herd effect).
  4. +
  5. If the pathname created in step 1 has the lowest sequence number suffix, the client has the lock and the client exits the protocol.
  6. +
  7. The client calls exists( ) with the watch flag set on the path in the lock directory with the next lowest sequence number.
  8. +
  9. if exists( ) returns null, go to step 2. Otherwise, wait for a notification for the pathname from the previous step before going to step 2.
  10. +
+

The unlock protocol is very simple: clients wishing to release a lock simply delete the node they created in step 1.

+

Here are a few things to notice:

+
    +
  • The removal of a node will only cause one client to wake up since each node is watched by exactly one client. In this way, you avoid the herd effect.
  • +
  • There is no polling or timeouts.
  • +
  • Because of the way you implement locking, it is easy to see the amount of lock contention, break locks, debug locking problems, etc.
  • +
+

Recoverable Errors and the GUID

+
    +
  • If a recoverable error occurs calling create() the client should call getChildren() and check for a node containing the guid used in the path name. This handles the case (noted above) of the create() succeeding on the server but the server crashing before returning the name of the new node.
  • +
+

Java Classes

DistributedLock

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
public interface DistributedLock {
void lock() throws LockingException;

void unlock() throws LockingException;

class LockingException extends RuntimeException {
public LockingException(String msg, Exception e) {
super(msg, e);
}

public LockingException(String msg) {
super(msg);
}
}
}
+ +

ZooKeeperLock

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
public class ZooKeeperLock implements DistributedLock, Watcher {
public ZooKeeperLock(ZooKeeper zooKeeper, List<ACL> acl, String lockerPath) throws KeeperException, InterruptedException {
}

static void ensurePath(ZooKeeper zooKeeper, String path) throws KeeperException, InterruptedException {
}

@Override
public synchronized void lock() throws LockingException {
}

@Override
public synchronized void unlock() throws LockingException {
}

@Override
public void process(WatchedEvent event) {
}
}

+ +

Performance Tests

ZooKeeper locks is network and disk heavy program, network throughput is 33 Kpkt/s at 2300 TPS. Windows is much slower than Linux in such case.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Disk typeWindowsLinux
HDD SATA30 TPS45 TPS
SSD SATA110 TPS400 TPS
SSD NVME-1300 TPS
TMPFS-2300 TPS
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/03/29/open-source-mirrors/index.html b/2020/03/29/open-source-mirrors/index.html new file mode 100644 index 00000000..9e7fa706 --- /dev/null +++ b/2020/03/29/open-source-mirrors/index.html @@ -0,0 +1,214 @@ + + + + + + + + + + + + Open source mirrors | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Open source mirrors +

+ +

Open source mirrors

Mirror lists

+

Operating System

Alpine

1
2
3
4
# https://mirrors.huaweicloud.com/alpine/v3.11/releases/x86_64/alpine-standard-3.11.5-x86_64.iso

cp -a /etc/apk/repositories /etc/apk/repositories.bak
sed -i "s@http://dl-cdn.alpinelinux.org/@https://mirrors.huaweicloud.com/@g" /etc/apk/repositories
+ +

Debian

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# https://mirrors.huaweicloud.com/debian-cd/current/amd64/iso-cd/debian-10.3.0-amd64-netinst.iso
# https://mirrors.huaweicloud.com/debian-cd/current/arm64/iso-cd/debian-10.3.0-arm64-netinst.iso
# https://mirrors.huaweicloud.com/debian-cd/current/s390x/iso-cd/debian-10.3.0-s390x-netinst.iso

deb https://mirrors.huaweicloud.com/debian/ buster main contrib non-free
deb https://mirrors.huaweicloud.com/debian/ buster-updates main contrib non-free
deb https://mirrors.huaweicloud.com/debian/ buster-proposed-updates main contrib non-free
deb https://mirrors.huaweicloud.com/debian/ buster-backports main contrib non-free
deb https://mirrors.huaweicloud.com/debian-security/ buster/updates main contrib non-free

#deb http://mirrors.163.com/debian/ buster main contrib non-free
#deb http://mirrors.163.com/debian/ buster-updates main contrib non-free
#deb http://mirrors.163.com/debian/ buster-proposed-updates main contrib non-free
#deb http://mirrors.163.com/debian/ buster-backports main contrib non-free
#deb http://mirrors.163.com/debian-security/ buster-backports main contrib non-free

#deb http://deb.debian.org/debian/ buster main contrib non-free
#deb http://deb.debian.org/debian/ buster-updates main contrib non-free
#deb http://deb.debian.org/debian/ buster-proposed-updates main contrib non-free
#deb http://deb.debian.org/debian/ buster-backports main contrib non-free
#deb http://security.debian.org/debian-security/ buster/updates main contrib non-free

#deb http://deb.debian.org/debian/ testing main contrib non-free
#deb http://deb.debian.org/debian/ testing-updates main contrib non-free
#deb http://deb.debian.org/debian/ testing-proposed-updates main contrib non-free

#deb http://deb.debian.org/debian/ unstable main contrib non-free
+ + +

Ubuntu

1
2
3
# https://mirrors.huaweicloud.com/ubuntu-cdimage/releases/18.04/release/ubuntu-18.04.4-server-amd64.iso
# https://mirrors.huaweicloud.com/ubuntu-cdimage/releases/18.04/release/ubuntu-18.04.4-server-arm64.iso
# https://mirrors.huaweicloud.com/ubuntu-cdimage/releases/18.04/release/ubuntu-18.04.4-server-s390x.iso
+ +

Languages

Java & maven

1
2
3
4
5
<mirror>
<id>huaweicloud</id>
<mirrorOf>*</mirrorOf>
<url>https://mirrors.huaweicloud.com/repository/maven/</url>
</mirror>
+ +

Node.js & npm

1
2
3
4
5
6
7
# https://mirrors.huaweicloud.com/nodejs/latest-v12.x/
# https://mirrors.huaweicloud.com/node-sass/?C=M&O=D

npm config set registry https://mirrors.huaweicloud.com/repository/npm/
npm config set disturl https://mirrors.huaweicloud.com/nodejs
npm config set sass_binary_site https://mirrors.huaweicloud.com/node-sass
npm cache clean -f
+ +

Python & PyPI

1
2
3
4
pip install \
--trusted-host https://mirrors.huaweicloud.com \
-i https://mirrors.huaweicloud.com/repository/pypi/simple \
<packages>
+ +
1
2
3
4
5
6
# ~/.pip/pip.conf
# C:\Users\<UserName>\pip\pip.ini
[global]
index-url = https://mirrors.huaweicloud.com/repository/pypi/simple
trusted-host = mirrors.huaweicloud.com
timeout = 120
+ +

Ruby & RubyGems

1
2
3
4
5
gem update --system
gem sources -l

gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/
gem sources -l
+ + +

Go & Modules

1
2
# https://proxy.golang.org
export GOPROXY=https://mirrors.aliyun.com/goproxy/
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/04/04/cargo-source-replacement/index.html b/2020/04/04/cargo-source-replacement/index.html new file mode 100644 index 00000000..e6826e31 --- /dev/null +++ b/2020/04/04/cargo-source-replacement/index.html @@ -0,0 +1,285 @@ + + + + + + + + + + + + Cargo Source Replacement | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Cargo Source Replacement +

+ +

Cargo Source Replacement

Environment variables and configurations

+

Rustup profiles

Rustup profiles are groups of components you can choose to download while installing a new Rust toolchain. The profiles available at this time are minimal, default, and complete:

+
    +
  • The minimal profile includes as few components as possible to get a working compiler (rustc, rust-std, and cargo). It’s recommended to use this component on Windows systems if you don’t use local documentation, and in CI.
  • +
  • The default profile includes all the components previously installed by default (rustc, rust-std, cargo, and rust-docs) plus rustfmt and clippy. This profile will be used by rustup by default, and it’s the one recommended for general use.
  • +
  • The complete profile includes all the components available through rustup, including miri and IDE integration tools (rls and rust-analysis).
  • +
+

To change the rustup profile you can use the rustup set profile command. For example, to select the minimal profile you can use:

+
1
rustup set profile minimal
+ +

Rustup components history

+

Rustup installation

1
2
3
4
5
6
7
8
# curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
| sh -s -- --profile minimal --default-toolchain nightly

# export CARGO_HTTP_PROXY="socks5h://proxy.example.com"
# export CARGO_HOME=/opt/rust
# export CARGO_HTTP_MULTIPLEXING=true

$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
+ +
1
2
3
4
5
6
$url = "https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe"
$output = "rustup-init-x86_64-pc-windows-msvc.exe"
$start_time = Get-Date

Invoke-WebRequest -Uri $url -OutFile $output
Write-Output "Time taken: $((Get-Date).Subtract($start_time).Seconds) second(s)"
+ +
1
2
3
4
5
6
7
8
$url = "https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe"
$output = "rustup-init-x86_64-pc-windows-msvc.exe"
$start_time = Get-Date

(New-Object System.Net.WebClient).DownloadFile($url, $output)

Write-Output "Time taken: $((Get-Date).Subtract($start_time).Seconds) second(s)"

+ +
1
2
3
4
5
6
7
8
9
$url = "https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe"
$output = "rustup-init-x86_64-pc-windows-msvc.exe"
$start_time = Get-Date

Import-Module BitsTransfer
Start-BitsTransfer -Source $url -Destination $output
# Start-BitsTransfer -Source $url -Destination $output -Asynchronous

Write-Output "Time taken: $((Get-Date).Subtract($start_time).Seconds) second(s)"
+ +

Build offline

1
2
3
cargo fetch --target x86_64-unknown-linux-gnu --verbose

cargo build --release --offline --frozen --target x86_64-unknown-linux-gnu --verbose
+ +
1
2
3
cargo vendor

cargo build --release --offline --frozen --target x86_64-unknown-linux-gnu --verbose
+ +

Overriding dependencies

The desire to override a dependency can arise through a number of scenarios. Most of them, however, boil down to the ability to work with a crate before it’s been published to crates.io. For example:

+
    +
  • A crate you’re working on is also used in a much larger application you’re working on, and you’d like to test a bug fix to the library inside of the larger application.
  • +
  • An upstream crate you don’t work on has a new feature or a bug fix on the master branch of its git repository which you’d like to test out.
  • +
  • You’re about to publish a new major version of your crate, but you’d like to do integration testing across an entire package to ensure the new major version works.
  • +
  • You’ve submitted a fix to an upstream crate for a bug you found, but you’d like to immediately have your application start depending on the fixed version of the crate to avoid blocking on the bug fix getting merged.
  • +
+

These scenarios can be solved with the [patch] manifest section.

+

Let’s say you’re working with the uuid crate but while you’re working on it you discover a bug. You are, however, quite enterprising so you decide to also try to fix the bug!

+
1
2
3
4
5
6
7
8
9
10
[package]
name = "my-library"
version = "0.1.0"
authors = ["..."]

[dependencies]
uuid = "1.0"

[patch.crates-io]
uuid = { path = "../path/to/uuid" }
+ +

If you are working with an unpublished minor version, just edit Cargo.toml:

+
1
2
3
4
5
6
7
8
9
10
[package]
name = "my-library"
version = "0.1.0"
authors = ["..."]

[dependencies]
uuid = "1.0"

[patch.crates-io]
uuid = { git = "https://github.com/uuid-rs/uuid", branch = "2.0.0" }
+ +

In case the dependency you want to override isn’t loaded from crates.io, you’ll have to change a bit how you use [patch]. For example, if the dependency is a git dependency, you can override it to a local path with:

+
1
2
[patch."https://github.com/your/repository"]
my-library = { path = "../my-library/path" }
+ +

Using an alternate registry

To use a registry other than crates.io, the name and index URL of the registry must be added to a .cargo/config file. The registries table has a key for each registry, for example:

+
1
2
[registries]
my-registry = { index = "https://my-intranet:8080/git/index" }
+ +

The index key should be a URL to a git repository with the registry’s index. A crate can then depend on a crate from another registry by specifying the registry key and a value of the registry’s name in that dependency’s entry in Cargo.toml:

+
1
2
3
4
5
6
[package]
name = "my-project"
version = "0.1.0"

[dependencies]
other-crate = { version = "1.0", registry = "my-registry" }
+ +

Source replacement

This document is about replacing the crate index. You can read about overriding dependencies in the overriding dependencies section of this documentation.

+

A source is a provider that contains crates that may be included as dependencies for a package. Cargo supports the ability to replace one source with another to express strategies such as:

+
    +
  • Vendoring - custom sources can be defined which represent crates on the local filesystem. These sources are subsets of the source that they’re replacing and can be checked into packages if necessary.

    +
  • +
  • Mirroring - sources can be replaced with an equivalent version which acts as a cache for crates.io itself.

    +
  • +
+

Cargo has a core assumption about source replacement that the source code is exactly the same from both sources. Note that this also means that a replacement source is not allowed to have crates which are not present in the original source.

+

As a consequence, source replacement is not appropriate for situations such as patching a dependency or a private registry. Cargo supports patching dependencies through the usage of the [patch] key, and private registry support is described in the Registries chapter.

+

Configuration of replacement sources is done through .cargo/config and the full set of available keys are:

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
[source]

[source.my-vendor-source]
directory = "vendor"

[source.crates-io]
replace-with = "my-vendor-source"

# Each source has its own table where the key is the name of the source
[source.the-source-name]

# Indicate that `the-source-name` will be replaced with `another-source`,
# defined elsewhere
replace-with = "another-source"

# Several kinds of sources can be specified (described in more detail below):
registry = "https://example.com/path/to/index"
local-registry = "path/to/registry"
directory = "path/to/vendor"

# Git sources can optionally specify a branch/tag/rev as well
git = "https://example.com/path/to/repo"
# branch = "master"
# tag = "v1.0.1"
# rev = "313f44e8"
+ +

Vendor all dependencies for a project locally

This cargo subcommand will vendor all crates.io and git dependencies for a project into the specified directory at . After this command completes the vendor directory specified by will contain all remote sources from dependencies specified. Additional manifests beyond the default one can be specified with the -s option.

+

The cargo vendor command will also print out the configuration necessary to use the vendored sources, which you will need to add to .cargo/config.

+
1
cargo vendor [OPTIONS] [PATH]
+ +
1
2
3
4
5
6
7
8
cargo install cargo-prefetch
cargo prefetch
cargo prefetch --list

cargo prefetch serde
cargo prefetch serde@=1.0.90

cargo prefetch --top-downloads=400
+ +

Find out what takes most of the space in your executable.

1
2
3
4
5
6
7
8
9
10
11
12
cargo install cargo-bloat
cargo install cargo-bloat --features regex-filter

# Get a list of the biggest functions in the release build
% cargo bloat --release -n 10

# Get a list of the biggest dependencies in the release build:
% cargo bloat --release --crates

# Get a list of the biggest functions in the release build filtered by the regexp:
# Note: you have to build cargo-bloat with a regex-filter feature enabled.
% cargo bloat --release --filter '^__' -n 10
+ +

Building dependency graphs

Dependencies are colored depending on their kind:

+
    +
  • Black: regular dependency
  • +
  • Purple: build dependency
  • +
  • Blue: dev dependency
  • +
  • Red: optional dependency
  • +
+
1
2
3
4
5
cargo install cargo-deps
cargo deps | dot -Tpng > graph.png

# The default behavior is to exclude optional, dev, and build dependencies. To see all dependencies, pass --all-deps:
cargo deps --all-deps | dot -Tpng > graph.png
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/04/05/ndk-console-program/index.html b/2020/04/05/ndk-console-program/index.html new file mode 100644 index 00000000..cd5d2a25 --- /dev/null +++ b/2020/04/05/ndk-console-program/index.html @@ -0,0 +1,206 @@ + + + + + + + + + + + + NDK console program | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ NDK console program +

+ +

NDK console program

Install NDK

+
1
2
3
4
5
6
7
8
9
export NDK_BUNDLE_DIR=/opt/android-ndk-r21b
export NDK_DL_URL=https://dl.google.com/android/repository/android-ndk-r21b-linux-x86_64.zip
export PATH=/opt/maven-3/bin:/opt/jdk-8/bin:/usr/sbin:/usr/bin:/sbin:/bin
export PATH=${NDK_BUNDLE_DIR}/toolchains/llvm/prebuilt/linux-x86_64/bin:${NDK_BUNDLE_DIR}:$PATH

/bin/rm -fr ${NDK_BUNDLE_DIR} \
&& mkdir -p ${NDK_BUNDLE_DIR} \
&& curl -sSL -o /tmp/ndk.zip ${NDK_DL_URL} \
&& (cd ${NDK_BUNDLE_DIR}/.. && unzip /tmp/ndk.zip)
+ +

Hello, World

Hello.c

1
2
3
4
5
6
7
8
9
10
/*
* gcc -g -std=c11 -Wall -Wextra -Wformat -pedantic -o Hello Hello.c
* valgrind -v ./Hello
*/
#include <stdio.h>
int main()
{
printf("Hello, World!\n");
return 0;
}
+ +

Hello.cpp

1
2
3
4
5
6
7
8
9
10
/*
* g++ -g -std=c++17 -Wall -Wextra -Wformat -pedantic -o Hello Hello.cpp
* valgrind -v ./Hello
*/
#include <iostream>
int main()
{
std::cout << "Hello, World!" << std::endl;
return 0;
}
+ +

Android.mk

1
2
3
4
5
6
7
8
9
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

LOCAL_MODULE := Hello

LOCAL_SRC_FILES := Hello.c
#LOCAL_SRC_FILES := Hello.cpp

include $(BUILD_EXECUTABLE)
+ +

Application.mk

1
2
3
4
5
6
APP_PLATFORM := android-24
APP_BUILD_SCRIPT := Android.mk
APP_ABI := armeabi-v7a arm64-v8a x86_64

APP_STL := none
#APP_STL := c++_static
+ +

ndk-build

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# ndk-build NDK_PROJECT_PATH=. NDK_APPLICATION_MK=Application.mk
[armeabi-v7a] Executable : Hello
[armeabi-v7a] Install : Hello => libs/armeabi-v7a/Hello
[arm64-v8a] Compile : Hello <= Hello.c
[arm64-v8a] Executable : Hello
[arm64-v8a] Install : Hello => libs/arm64-v8a/Hello
[x86_64] Compile : Hello <= Hello.c
[x86_64] Executable : Hello
[x86_64] Install : Hello => libs/x86_64/Hello

# file libs/armeabi-v7a/Hello libs/arm64-v8a/Hello libs/x86_64/Hello
libs/armeabi-v7a/Hello: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /system/bin/linker, BuildID[sha1]=899b8ea06a0b7372e7eef43db09bc145d5140ca5, stripped
libs/arm64-v8a/Hello: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /system/bin/linker64, BuildID[sha1]=1d490b72bbf70379b127a49f60d0383a62312937, stripped
libs/x86_64/Hello: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /system/bin/linker64, BuildID[sha1]=2af85ada459a58e93ab96e7aceb5b546f8bce80d, stripped

arm-linux-androideabi-readelf -h libs/armeabi-v7a/Hello
arm-linux-androideabi-readelf -A libs/armeabi-v7a/Hello
arm-linux-androideabi-readelf -p .interp libs/armeabi-v7a/Hello
arm-linux-androideabi-readelf -p .rodata libs/armeabi-v7a/Hello

aarch64-linux-android-readelf -h libs/arm64-v8a/Hello
aarch64-linux-android-readelf -p .interp libs/arm64-v8a/Hello
aarch64-linux-android-readelf -p .rodata libs/arm64-v8a/Hello
+ +

Android Debug Bridge

1
2
3
4
5
6
7
8
adb push libs/armeabi-v7a/Hello /data/local/tmp/Hello
adb shell /data/local/tmp/Hello

adb push libs/arm64-v8a/Hello /data/local/tmp/Hello
adb shell /data/local/tmp/Hello

adb push libs/x86_64/Hello /data/local/tmp/Hello
adb shell /data/local/tmp/Hello
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/04/06/compile-rsync-by-ndk/index.html b/2020/04/06/compile-rsync-by-ndk/index.html new file mode 100644 index 00000000..e337c2ac --- /dev/null +++ b/2020/04/06/compile-rsync-by-ndk/index.html @@ -0,0 +1,232 @@ + + + + + + + + + + + + Compile rsync by NDK | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Compile rsync by NDK +

+ +

Compile rsync by NDK

Install NDK

+
1
2
3
4
5
6
7
8
9
export NDK_BUNDLE_DIR=/opt/android-ndk-r21b
export NDK_DL_URL=https://dl.google.com/android/repository/android-ndk-r21b-linux-x86_64.zip
export PATH=/opt/maven-3/bin:/opt/jdk-8/bin:/usr/sbin:/usr/bin:/sbin:/bin
export PATH=${NDK_BUNDLE_DIR}/toolchains/llvm/prebuilt/linux-x86_64/bin:${NDK_BUNDLE_DIR}:$PATH

/bin/rm -fr ${NDK_BUNDLE_DIR} \
&& mkdir -p ${NDK_BUNDLE_DIR} \
&& curl -sSL -o /tmp/ndk.zip ${NDK_DL_URL} \
&& (cd ${NDK_BUNDLE_DIR}/.. && unzip /tmp/ndk.zip)
+ +

Android API levels

+
1
2
3
4
# ls android-ndk-r21b/platforms | sort
android-16 android-17 android-18 android-19
android-21 android-22 android-23 android-24
android-26 android-27 android-28 android-29
+ +

Android Clang targets

+ + + + + + + + + + + + + + + + + + +
Linux target tripletsAndroid Clang target parameter
arm-linux-androideabi-*–target=armv7a-linux-androideabi24
aarch64-linux-android-*–target=aarch64-linux-android24
x86_64-linux-android-*–target=x86_64-linux-android24
+

Rsync on Android 7.0 (API Level 24) or later

armv7a-linux-androideabi24

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/bin/rm -fr /tmp/rsync && mkdir -p /tmp/rsync && cd /tmp/rsync && \
curl -sSL https://download.samba.org/pub/rsync/rsync-3.1.3.tar.gz \
| tar -xvz --strip-components 1 -C /tmp/rsync

export NDK_TARGET=arm-linux-androideabi
./configure --host="armv7a-linux-androideabi24" \
AR="${NDK_BUNDLE_DIR}/toolchains/llvm/prebuilt/linux-x86_64/bin/${NDK_TARGET}-ar" \
CC="${NDK_BUNDLE_DIR}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7a-linux-androideabi24" \
LD="${NDK_BUNDLE_DIR}/toolchains/llvm/prebuilt/linux-x86_64/bin/${NDK_TARGET}-ld" \
RANLIB="${NDK_BUNDLE_DIR}/toolchains/llvm/prebuilt/linux-x86_64/bin/${NDK_TARGET}-ranlib" \
STRIP="${NDK_BUNDLE_DIR}/toolchains/llvm/prebuilt/linux-x86_64/bin/${NDK_TARGET}-strip"

make && ${NDK_BUNDLE_DIR}/toolchains/llvm/prebuilt/linux-x86_64/bin/${NDK_TARGET}-strip rsync

install -m 755 rsync /tmp/rsync-3.1.3.armv7a-androideabi
+ +

aarch64-linux-android24

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/bin/rm -fr /tmp/rsync && mkdir -p /tmp/rsync && cd /tmp/rsync && \
curl -sSL https://download.samba.org/pub/rsync/rsync-3.1.3.tar.gz \
| tar -xvz --strip-components 1 -C /tmp/rsync

export NDK_TARGET=aarch64-linux-android
./configure --host="${NDK_TARGET}24" \
AR="${NDK_BUNDLE_DIR}/toolchains/llvm/prebuilt/linux-x86_64/bin/${NDK_TARGET}-ar" \
CC="${NDK_BUNDLE_DIR}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=${NDK_TARGET}24" \
LD="${NDK_BUNDLE_DIR}/toolchains/llvm/prebuilt/linux-x86_64/bin/${NDK_TARGET}-ld" \
RANLIB="${NDK_BUNDLE_DIR}/toolchains/llvm/prebuilt/linux-x86_64/bin/${NDK_TARGET}-ranlib" \
STRIP="${NDK_BUNDLE_DIR}/toolchains/llvm/prebuilt/linux-x86_64/bin/${NDK_TARGET}-strip"

make && ${NDK_BUNDLE_DIR}/toolchains/llvm/prebuilt/linux-x86_64/bin/${NDK_TARGET}-strip rsync

install -m 755 rsync /tmp/rsync-3.1.3.aarch64-android
+ +

x86_64-linux-android24

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/bin/rm -fr /tmp/rsync && mkdir -p /tmp/rsync && cd /tmp/rsync && \
curl -sSL https://download.samba.org/pub/rsync/rsync-3.1.3.tar.gz \
| tar -xvz --strip-components 1 -C /tmp/rsync

export NDK_TARGET=x86_64-linux-android
./configure --host="${NDK_TARGET}24" \
AR="${NDK_BUNDLE_DIR}/toolchains/llvm/prebuilt/linux-x86_64/bin/${NDK_TARGET}-ar" \
CC="${NDK_BUNDLE_DIR}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=${NDK_TARGET}24" \
LD="${NDK_BUNDLE_DIR}/toolchains/llvm/prebuilt/linux-x86_64/bin/${NDK_TARGET}-ld" \
RANLIB="${NDK_BUNDLE_DIR}/toolchains/llvm/prebuilt/linux-x86_64/bin/${NDK_TARGET}-ranlib" \
STRIP="${NDK_BUNDLE_DIR}/toolchains/llvm/prebuilt/linux-x86_64/bin/${NDK_TARGET}-strip"

make && ${NDK_BUNDLE_DIR}/toolchains/llvm/prebuilt/linux-x86_64/bin/${NDK_TARGET}-strip rsync

install -m 755 rsync /tmp/rsync-3.1.3.x86_64-android
+ +

Android Debug Bridge

Review build results

1
2
3
4
5
6
7
8
9
10
11
# touch -t 197001010000 rsync*android*

# ls -l rsync*android*
-rwxr-xr-x 1 root root 471336 Jan 1 1970 rsync-3.1.3.aarch64-android
-rwxr-xr-x 1 root root 473224 Jan 1 1970 rsync-3.1.3.armv7a-androideabi
-rwxr-xr-x 1 root root 500264 Jan 1 1970 rsync-3.1.3.x86_64-android

# file rsync*android*
rsync-3.1.3.aarch64-android: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /system/bin/linker64, stripped
rsync-3.1.3.armv7a-androideabi: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /system/bin/linker, stripped
rsync-3.1.3.x86_64-android: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /system/bin/linker64, stripped
+ +

armv7a-linux-androideabi24

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
adb push rsync-3.1.3.armv7a-androideabi /data/local/tmp/rsync
adb shell chmod 755 /data/local/tmp/rsync

# adb shell /data/local/tmp/rsync --version
rsync version 3.1.3 protocol version 31
Copyright (C) 1996-2018 by Andrew Tridgell, Wayne Davison, and others.
Web site: http://rsync.samba.org/
Capabilities:
64-bit files, 64-bit inums, 32-bit timestamps, 64-bit long ints,
no socketpairs, hardlinks, symlinks, no IPv6, batchfiles, inplace,
append, no ACLs, xattrs, no iconv, symtimes, prealloc

rsync comes with ABSOLUTELY NO WARRANTY. This is free software, and you
are welcome to redistribute it under certain conditions. See the GNU
General Public Licence for details.
+ +

aarch64-linux-android24

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
adb push rsync-3.1.3.aarch64-android /data/local/tmp/rsync
adb shell chmod 755 /data/local/tmp/rsync

# adb shell /data/local/tmp/rsync --version
rsync version 3.1.3 protocol version 31
Copyright (C) 1996-2018 by Andrew Tridgell, Wayne Davison, and others.
Web site: http://rsync.samba.org/
Capabilities:
64-bit files, 64-bit inums, 64-bit timestamps, 64-bit long ints,
no socketpairs, hardlinks, symlinks, no IPv6, batchfiles, inplace,
append, no ACLs, xattrs, no iconv, symtimes, prealloc

rsync comes with ABSOLUTELY NO WARRANTY. This is free software, and you
are welcome to redistribute it under certain conditions. See the GNU
General Public Licence for details.
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/04/11/rsync-backup-for-android-device/index.html b/2020/04/11/rsync-backup-for-android-device/index.html new file mode 100644 index 00000000..e82e8cb5 --- /dev/null +++ b/2020/04/11/rsync-backup-for-android-device/index.html @@ -0,0 +1,225 @@ + + + + + + + + + + + + Rsync backup for Android device | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Rsync backup for Android device +

+ +

Rsync backup for Android device

After compile rsync by NDK, we can do rsync backup for Android device.

+

Debian Linux preparation

1
2
3
sudo apt-get update && sudo apt-get dist-upgrade --no-install-recommends -y && \
sudo apt-get install --no-install-recommends -y android-tools-adb rsync

+ +

Android device preparation

    +
  1. Enter “Developer Mode”
  2. +
  3. Enable “USB Debugging”
  4. +
  5. Plug in your Android device via USB cable to your backup target machine
  6. +
  7. Allows “USB debugging” on the Android device
  8. +
  9. Root is recommended. You can run rsync process as normal user, but would be restricted in the files are permitted to read from your Android device.
  10. +
+

Environmental verification

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
$ dmesg -w
[90130.442467] usb 2-12: new high-speed USB device number 18 using xhci_hcd
[90130.464457] usb 2-12: New USB device found, idVendor=2717, idProduct=ff48, bcdDevice= 3.18
[90130.464462] usb 2-12: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[90130.464465] usb 2-12: Product: MI 5
[90130.464467] usb 2-12: Manufacturer: Xiaomi
[90130.464469] usb 2-12: SerialNumber: 19975a8b
[90132.762782] usb 2-12: USB disconnect, device number 18

$ lsusb | grep Xiaomi
Bus 002 Device 021: ID 2717:ff48 Xiaomi Inc. Mi/Redmi series (MTP + ADB)

$ adb devices
List of devices attached
* daemon not running; starting now at tcp:5037
* daemon started successfully
19975a8b device

$ adb shell df -h
Filesystem Size Used Avail Use% Mounted on
rootfs 1.2G 6.1M 1.2G 1% /
tmpfs 1.2G 732K 1.2G 1% /dev
/dev/block/dm-0 2.8G 2.6G 190M 94% /system
tmpfs 1.2G 0 1.2G 0% /mnt
none 1.2G 0 1.2G 0% /sys/fs/cgroup
/dev/block/sde38 806M 480M 310M 61% /cust
/dev/block/sda12 27M 1.4M 25M 6% /persist
/dev/block/sda13 248M 204K 243M 1% /cache
/dev/block/sde32 12M 4.1M 7.3M 36% /dsp
/dev/block/sde35 192M 98M 94M 51% /firmware
/dev/block/sde26 1.0G 112K 1.0G 1% /bt_firmware
/dev/block/dm-1 54G 43G 11G 80% /data
/data/media 54G 43G 11G 80% /storage/emulated

/sdcard -> /storage/self/primary
storage/self/primary -> /mnt/user/0/primary
/mnt/user/0/primary -> /storage/emulated/0
+ +

Backup preparation

Push rsync to Android device

1
2
3
adb push rsync-3.1.3.aarch64-android /data/local/tmp/rsync
adb shell chmod 755 /data/local/tmp/rsync
adb shell /data/local/tmp/rsync --version
+ +

Please use the correct rsync binary for the Android device. If you got error messages like the following during backup:

+
1
/system/bin/sh: /data/local/tmp/rsync: not executable: 64-bit ELF file
+ +

or

+
1
2
rsync: safe_read failed to read 1 bytes [Receiver]: Connection reset by peer (104)
rsync error: error in rsync protocol data stream (code 12) at io.c(285) [Receiver=3.1.3]
+ +

Then you must have chosen the wrong rsync binary.

+

Push rsyncd.conf to Android device

1
adb shell 'exec > /data/local/tmp/rsyncd.conf && echo address = 127.0.0.1 && echo port = 1873 && echo "[root]" && echo path = / && echo use chroot = false && echo read only = false'
+ +

or

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
cat << EOF > rsyncd.conf
address = 127.0.0.1
port = 1873

[root]
path = /
chroot = false
read only = false

# If Android device rooted
#uid = root
#gid = root
EOF

adb push rsyncd.conf /data/local/tmp/rsyncd.conf
+ +

Open up a shell on Android device

1
2
3
4
adb -s A5RNW18316011440 shell

# If Android device rooted
# su -
+ +

Run the rsync server process on Android device

If Android device rooted:

+
1
adb -s A5RNW18316011440 shell su - -c "/data/local/tmp/rsync --daemon --no-detach --config=/data/local/tmp/rsyncd.conf --log-file=/proc/self/fd/2"
+ +

Otherwise:

+
1
2
adb shell '/data/local/tmp/rsync --daemon --no-detach --config=/data/local/tmp/rsyncd.conf --log-file=/proc/self/fd/2'
# adb shell '/data/local/tmp/rsync --daemon --config=/data/local/tmp/rsyncd.conf &'
+ +

Forward the target machine tcp port to Android device

1
adb forward tcp:1873 tcp:1873
+ +

Backup files from Android device to target machine

1
2
3
$ rsync -vrt --progress --stats \
rsync://localhost:1873/root/ \
~/xiaomi-backup/
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/04/12/build-busybox-in-docker/fedora.repo b/2020/04/12/build-busybox-in-docker/fedora.repo new file mode 100644 index 00000000..cd11d050 --- /dev/null +++ b/2020/04/12/build-busybox-in-docker/fedora.repo @@ -0,0 +1,47 @@ +[fedora] +name=Fedora $releasever - $basearch +baseurl=http://mirrors.163.com/fedora/releases/$releasever/Everything/$basearch/os/ +enabled=1 +countme=1 +metadata_expire=7d +repo_gpgcheck=0 +type=rpm +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch +skip_if_unavailable=False + +[updates] +name=Fedora $releasever - $basearch - Updates +baseurl=http://mirrors.163.com/fedora/updates/$releasever/Everything/$basearch/ +enabled=1 +countme=1 +repo_gpgcheck=0 +type=rpm +gpgcheck=1 +metadata_expire=6h +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch +skip_if_unavailable=False + +[fedora-modular] +name=Fedora Modular $releasever - $basearch +baseurl=http://mirrors.163.com/fedora/releases/$releasever/Modular/$basearch/os/ +enabled=1 +countme=1 +metadata_expire=7d +repo_gpgcheck=0 +type=rpm +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch +skip_if_unavailable=False + +[updates-modular] +name=Fedora Modular $releasever - $basearch - Updates +baseurl=http://mirrors.163.com/fedora/updates/$releasever/Modular/$basearch/ +enabled=1 +countme=1 +repo_gpgcheck=0 +type=rpm +gpgcheck=1 +metadata_expire=6h +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch +skip_if_unavailable=False diff --git a/2020/04/12/build-busybox-in-docker/index.html b/2020/04/12/build-busybox-in-docker/index.html new file mode 100644 index 00000000..437174a6 --- /dev/null +++ b/2020/04/12/build-busybox-in-docker/index.html @@ -0,0 +1,223 @@ + + + + + + + + + + + + Build BusyBox in Docker | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Build BusyBox in Docker +

+ +

Build BusyBox in Docker

Download BusyBox

1
2
3
4
5
6
7
8
9
10
11
12
13
# aria2c https://busybox.net/downloads/busybox-1.31.1.tar.bz2

06/09 13:43:20 [NOTICE] Downloading 1 item(s)

06/09 13:43:21 [NOTICE] Download complete: /tmp/tmp.e6xObfyoNJ/busybox-1.31.1.tar.bz2

Download Results:
gid |stat|avg speed |path/URI
======+====+===========+=======================================================
201313|OK | 12MiB/s|/tmp/tmp.e6xObfyoNJ/busybox-1.31.1.tar.bz2

Status Legend:
(OK):download completed.
+ +

Build BusyBox by Fedora

Create the Container

1
# docker run --rm -it -v `pwd`:/root -w /tmp fedora:31
+ +

Setup repository mirrors

Only if you are happy with the my repository settings of Fedora.

+
1
2
# rm -f /etc/yum.repos.d/*
# cp /root/fedora.repo /etc/yum.repos.d/
+ +

Install packages

1
2
3
# dnf upgrade --setopt=install_weak_deps=False --best --assumeyes
# dnf install --setopt=install_weak_deps=False --best --assumeyes \
bzip2 which findutils diffutils file procps-ng make gcc
+ +

Build BusyBox

1
2
3
4
5
# tar -xjf /root/busybox-1.31.1.tar.bz2
# cd busybox-1.31.1/

# make defconfig
# make -j4
+ +

Verification

1
2
3
4
5
6
7
8
9
# du -ks busybox busybox_unstripped
944 busybox
1108 busybox_unstripped

# file busybox busybox_unstripped
busybox: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=17eedba515201d32d51f6d010dab4058562cd300, for GNU/Linux 3.2.0, stripped
busybox_unstripped: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=17eedba515201d32d51f6d010dab4058562cd300, for GNU/Linux 3.2.0, not stripped

# ./busybox
+ +

Build BusyBox by Ubuntu or Debian

Create the Container

For Ubuntu:

+
1
# docker run --rm -it -v `pwd`:/root -w /tmp ubuntu:18.04
+ +

For Debian:

+
1
# docker run --rm -it -v `pwd`:/root -w /tmp debian:10
+ +

Setup repository mirrors

Only if you are happy with the my repository settings of Ubuntu or Debian.

+

For Ubuntu:

+
1
# cp /root/sources-1804.list /etc/apt/sources.list
+ +

For Debian:

+
1
# cp /root/sources-10.list /etc/apt/sources.list
+ +

Install packages

1
2
3
# apt-get update && apt-get dist-upgrade -y
# apt-get install -y --no-install-recommends \
bzip2 findutils diffutils file procps make gcc libc6-dev
+ +

Build BusyBox

1
2
3
4
5
# tar -xjf /root/busybox-1.31.1.tar.bz2
# cd busybox-1.31.1/

# make defconfig
# make -j4
+ +

Verification

For Ubuntu:

+
1
2
3
4
5
6
7
8
9
# du -ks busybox busybox_unstripped
1024 busybox
1192 busybox_unstripped

# file busybox busybox_unstripped
busybox: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=716c4b5f55a8fa42cc3d2935320ec949a25a628d, stripped
busybox_unstripped: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=716c4b5f55a8fa42cc3d2935320ec949a25a628d, not stripped

# ./busybox
+ +

For Debian:

+
1
2
3
4
5
6
7
8
9
# du -ks busybox busybox_unstripped
984 busybox
1148 busybox_unstripped

# file busybox busybox_unstripped
busybox: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=af33517e2bf0576ee99f201ef211b3cf1a1c4d28, stripped
busybox_unstripped: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=af33517e2bf0576ee99f201ef211b3cf1a1c4d28, not stripped

# ./busybox
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/04/12/build-busybox-in-docker/sources-10.list b/2020/04/12/build-busybox-in-docker/sources-10.list new file mode 100644 index 00000000..81128e28 --- /dev/null +++ b/2020/04/12/build-busybox-in-docker/sources-10.list @@ -0,0 +1,13 @@ +deb http://mirrors.163.com/debian/ buster main contrib non-free +deb http://mirrors.163.com/debian/ buster-updates main contrib non-free +deb http://mirrors.163.com/debian/ buster-proposed-updates main contrib non-free +deb http://mirrors.163.com/debian/ buster-backports main contrib non-free + +deb http://mirrors.163.com/debian-security/ buster/updates main contrib non-free + +# deb http://security.debian.org/debian-security/ buster/updates main contrib non-free + +# deb http://deb.debian.org/debian/ buster main contrib non-free +# deb http://deb.debian.org/debian/ buster-updates main contrib non-free +# deb http://deb.debian.org/debian/ buster-proposed-updates main contrib non-free +# deb http://deb.debian.org/debian/ buster-backports main contrib non-free diff --git a/2020/04/12/build-busybox-in-docker/sources-1804.list b/2020/04/12/build-busybox-in-docker/sources-1804.list new file mode 100644 index 00000000..bb5c3efb --- /dev/null +++ b/2020/04/12/build-busybox-in-docker/sources-1804.list @@ -0,0 +1,12 @@ +deb http://mirrors.163.com/ubuntu/ bionic main universe +deb http://mirrors.163.com/ubuntu/ bionic-updates main universe +deb http://mirrors.163.com/ubuntu/ bionic-proposed main universe +deb http://mirrors.163.com/ubuntu/ bionic-backports main universe +deb http://mirrors.163.com/ubuntu/ bionic-security main universe + +# deb http://security.ubuntu.com/ubuntu bionic-security main universe + +# deb http://archive.ubuntu.com/ubuntu/ bionic main restricted universe multiverse +# deb http://archive.ubuntu.com/ubuntu/ bionic-updates main restricted universe multiverse +# deb http://archive.ubuntu.com/ubuntu/ bionic-proposed main restricted universe multiverse +# deb http://archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse diff --git a/2020/04/18/welcome-to-cython/index.html b/2020/04/18/welcome-to-cython/index.html new file mode 100644 index 00000000..101e0f64 --- /dev/null +++ b/2020/04/18/welcome-to-cython/index.html @@ -0,0 +1,288 @@ + + + + + + + + + + + + Welcome to Cython | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Welcome to Cython +

+ +

Welcome to Cython

About Cython

Cython is an optimising static compiler for both the Python programming language and the extended Cython programming language (based on Pyrex). It makes writing C extensions for Python as easy as Python itself.

+

The Cython language is a superset of the Python language that additionally supports calling C functions and declaring C types on variables and class attributes. This allows the compiler to generate very efficient C code from Cython code. The C code is generated once and then compiles with all major C/C++ compilers in all later CPython versions.

+

Installing Cython

1
pip install Cython
+ +

Building Cython code

Cython code must, unlike Python, be compiled. This happens in two stages:

+
    +
  • A .pyx file is compiled by Cython to a .c file, containing the code of a Python extension module.
  • +
  • The .c file is compiled by a C compiler to a .so file (or .pyd on Windows) which can be import-ed directly into a Python session. setuptools takes care of this part. Although Cython can call them for you in certain cases.
  • +
+

There are several ways to build Cython code:

+
    +
  • Write a setuptools setup.py. This is the normal and recommended way.
  • +
  • Run the cython command-line utility manually to produce the .c file from the .pyx file, then manually compiling the .c file into a shared object library or DLL suitable for import from Python. (These manual steps are mostly for debugging and experimentation.)
  • +
+

Compiling with the cythonize command

Run the cythonize compiler command with your options and list of .pyx files to generate an extension module. For example:

+
1
$ cythonize -a -i yourmod.pyx
+ +

This creates a yourmod.c file (or yourmod.cpp in C++ mode), compiles it, and puts the resulting extension module (.so or .pyd, depending on your platform) next to the source file for direct import (-i builds “in place”). The -a switch additionally produces an annotated html file of the source code.

+

The cythonize command accepts multiple source files and glob patterns like **/*.pyx as argument and also understands the common -j option for running multiple parallel build jobs. When called without further options, it will only translate the source files to .c or .cpp files. Pass the -h flag for a complete list of supported options.

+

Building a Cython module using setuptools

Imagine a simple “hello world” script in a file hello.pyx:

+
1
2
def say_hello_to(name):
print("Hello %s!" % name)
+ +

The following could be a corresponding setup.py script:

+
1
2
3
4
5
6
7
8
from setuptools import setup
from Cython.Build import cythonize

setup(
name='Hello World Application',
ext_modules=cythonize("src/*.pyx"),
version="1.0.0",
)
+ +

To build, run python setup.py build_ext –inplace. Then simply start a Python session and do from hello import say_hello_to and use the imported function as you see fit.

+

Using C libraries

Apart from writing fast code, one of the main use cases of Cython is to call external C libraries from Python code. As Cython code compiles down to C code itself, it is actually trivial to call C functions directly in the code.

+

Defining external declarations

The C API of the queue implementation, which is defined in the header file c-algorithms/src/queue.h, essentially looks like this:

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/* queue.h */

typedef struct _Queue Queue;
typedef void *QueueValue;

Queue *queue_new(void);
void queue_free(Queue *queue);

int queue_push_head(Queue *queue, QueueValue data);
QueueValue queue_pop_head(Queue *queue);
QueueValue queue_peek_head(Queue *queue);

int queue_push_tail(Queue *queue, QueueValue data);
QueueValue queue_pop_tail(Queue *queue);
QueueValue queue_peek_tail(Queue *queue);

int queue_is_empty(Queue *queue);
+ +

The first step is to redefine the C API in a .pxd file

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#cython: language_level=3
#libuv.pyd

# https://github.com/fragglet/c-algorithms/blob/master/src/queue.h
# https://github.com/fragglet/c-algorithms/blob/master/src/queue.c
cdef extern from "c-algorithms/src/queue.h":
ctypedef struct Queue:
pass
ctypedef void* QueueValue

Queue* queue_new()
void queue_free(Queue* queue)

int queue_push_head(Queue* queue, QueueValue data)
QueueValue queue_pop_head(Queue* queue)
QueueValue queue_peek_head(Queue* queue)

int queue_push_tail(Queue* queue, QueueValue data)
QueueValue queue_pop_tail(Queue* queue)
QueueValue queue_peek_tail(Queue* queue)

bint queue_is_empty(Queue* queue)
+ +

Writing a wrapper class

After declaring our C library’s API, we can start to design the Queue class that should wrap the C queue. It will live in a file called queue.pyx.

+

Here is a first start for the Queue class:

+
1
2
3
4
5
6
7
8
9
# queue.pyx

cimport cqueue

cdef class Queue:
cdef cqueue.Queue* _c_queue

def __cinit__(self):
self._c_queue = cqueue.queue_new()
+ +

Memory management

Before we continue implementing the other methods, it is important to understand that the above implementation is not safe. In case anything goes wrong in the call to queue_new(), this code will simply swallow the error, so we will likely run into a crash later on. According to the documentation of the queue_new() function, the only reason why the above can fail is due to insufficient memory. In that case, it will return NULL, whereas it would normally return a pointer to the new queue.

+

The Python way to get out of this is to raise a MemoryError. We can thus change the init function as follows:

+
1
2
3
4
5
6
7
8
9
10
11
# queue.pyx

cimport cqueue

cdef class Queue:
cdef cqueue.Queue* _c_queue

def __cinit__(self):
self._c_queue = cqueue.queue_new()
if self._c_queue is NULL:
raise MemoryError()
+ +

The next thing to do is to clean up when the Queue instance is no longer used (i.e. all references to it have been deleted). To this end, CPython provides a callback that Cython makes available as a special method dealloc(). In our case, all we have to do is to free the C Queue, but only if we succeeded in initialising it in the init method:

+
1
2
3
def __dealloc__(self):
if self._c_queue is not NULL:
cqueue.queue_free(self._c_queue)
+ +

Mapping functionality

Adding an append() method should now be straight forward:

+
1
2
3
4
cdef append(self, int value):
if not cqueue.queue_push_tail(self._c_queue,
<void*>value):
raise MemoryError()
+ +

Adding an extend() method should now be straight forward:

+
1
2
3
4
5
6
cdef extend(self, int* values, size_t count):
"""Append all ints to the queue.
"""
cdef int value
for value in values[:count]: # Slicing pointer to limit the iteration boundaries.
self.append(value)
+ +

So far, we can only add data to the queue. The next step is to write the two methods to get the first element: peek() and pop(), which provide read-only and destructive read access respectively. To avoid compiler warnings when casting void* to int directly, we use an intermediate data type that is big enough to hold a void*. Here, Py_ssize_t:

+

cdef int peek(self): + return cqueue.queue_peek_head(self._c_queue)

+

cdef int pop(self): + return cqueue.queue_pop_head(self._c_queue)

+

Handling errors

Now, what happens when the queue is empty? According to the documentation, the functions return a NULL pointer, which is typically not a valid value. But since we are simply casting to and from ints, we cannot distinguish anymore if the return value was NULL because the queue was empty or because the value stored in the queue was 0. In Cython code, we want the first case to raise an exception, whereas the second case should simply return 0. To deal with this, we need to special case this value, and check if the queue really is empty or not:

+
1
2
3
4
5
6
7
8
cdef int peek(self) except? -1:
cdef int value = <Py_ssize_t>cqueue.queue_peek_head(self._c_queue)
if value == 0:
# this may mean that the queue is empty, or
# that it happens to contain a 0 value
if cqueue.queue_is_empty(self._c_queue):
raise IndexError("Queue is empty")
return value
+ +

Compiling and linking

At this point, we have a working Cython module that we can test. To compile it, we need to configure a setup.py script for setuptools. Here is the most basic script for compiling a Cython module:

+
1
2
3
4
5
6
from setuptools import Extension, setup
from Cython.Build import cythonize

setup(
ext_modules = cythonize([Extension("queue", ["queue.pyx"])])
)
+ +

To build against the external C library, we need to make sure Cython finds the necessary libraries. There are two ways to archive this. First we can tell setuptools where to find the c-source to compile the queue.c implementation automatically. Alternatively, we can build and install C-Alg as system library and dynamically link it.

+

Static Linking

To build the c-code automatically we need to include compiler directives in queue.pyx:

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# distutils: sources = c-algorithms/src/queue.c
# distutils: include_dirs = c-algorithms/src/

cimport cqueue

cdef class Queue:
cdef cqueue.Queue* _c_queue
def __cinit__(self):
self._c_queue = cqueue.queue_new()
if self._c_queue is NULL:
raise MemoryError()

def __dealloc__(self):
if self._c_queue is not NULL:
cqueue.queue_free(self._c_queue)
+ +

The sources compiler directive gives the path of the C files that setuptools is going to compile and link (statically) into the resulting extension module. In general all relevant header files should be found in include_dirs. Now we can build the project using:

+
1
$ python setup.py build_ext -i
+ +

And test whether our build was successful:

+
1
$ python -c 'import queue; Q = queue.Queue()'
+ +

Dynamic Linking

Dynamic linking is useful, if the library we are going to wrap is already installed on the system. To perform dynamic linking we first need to build and install c-alg.

+

In this approach we need to tell the setup script to link with an external library. To do so we need to extend the setup script to install change the extension setup from

+
1
ext_modules = cythonize([Extension("queue", ["queue.pyx"])])
+ +

to

+
1
2
3
4
ext_modules = cythonize([
Extension("queue", ["queue.pyx"],
libraries=["calg"])
])
+

Now we should be able to build the project using:

+
1
python setup.py build_ext -i
+ +

If the libcalg is not installed in a ‘normal’ location, users can provide the required parameters externally by passing appropriate C compiler flags, such as:

+
1
2
3
CFLAGS="-I/usr/local/otherdir/calg/include"  \
LDFLAGS="-L/usr/local/otherdir/calg/lib" \
python setup.py build_ext -i
+ +

Before we run the module, we also need to make sure that libcalg is in the LD_LIBRARY_PATH environment variable, e.g. by setting:

+
1
$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
+ +

Once we have compiled the module for the first time, we can now import it and instantiate a new Queue:

+
1
2
$ export PYTHONPATH=.
$ python -c 'import queue; Q = queue.Queue()'
+ +

Implementing functions in C

When you want to call C code from a Cython module, usually that code will be in some external library that you link your extension against. However, you can also directly compile C (or C++) code as part of your Cython module. In the .pyx file, you can put something like:

+
1
2
cdef extern from "spam.c":
void order_spam(int tons)
+ +

Cython will assume that the function order_spam() is defined in the file spam.c. If you also want to cimport this function from another module, it must be declared (not extern!) in the .pxd file:

+
1
cdef void order_spam(int tons)
+ +

For this to work, the signature of order_spam() in spam.c must match the signature that Cython uses, in particular the function must be static:

+
1
2
3
4
static void order_spam(int tons)
{
printf("Ordered %i tons of spam!\n", tons);
}
+ +

Including verbatim C code

For advanced use cases, Cython allows you to directly write C code as “docstring” of a cdef extern from block:

+
1
2
3
4
5
6
7
8
9
cdef extern from *:
"""
/* This is C code which will be put
* in the .c file output by Cython */
static long square(long x) {return x * x;}
#define assign(x, y) ((x) = (y))
"""
long square(long x)
void assign(long& x, long y)
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/04/19/quickly-deploy-oci-images-to-kubernetes/index.html b/2020/04/19/quickly-deploy-oci-images-to-kubernetes/index.html new file mode 100644 index 00000000..dca46eb7 --- /dev/null +++ b/2020/04/19/quickly-deploy-oci-images-to-kubernetes/index.html @@ -0,0 +1,193 @@ + + + + + + + + + + + + Quickly deploy OCI images to Kubernetes | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Quickly deploy OCI images to Kubernetes +

+ +

Quickly deploy OCI images to Kubernetes

Create a ephemeral pod

1
2
3
4
5
6
7
8
9
10
11
12
13
# https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#run

kubectl run -it --rm --restart=Never alpine --image=alpine
kubectl run -it --rm --restart=Never centos-7 --image=centos:7
kubectl run -it --rm --restart=Never centos-8 --image=centos:8
kubectl run -it --rm --restart=Never debian-stable --image=debian:stable
kubectl run -it --rm --restart=Never debian-testing --image=debian:testing
kubectl run -it --rm --restart=Never fedora32 --image=fedora:32
kubectl run -it --rm --restart=Never sle15 --image=registry.suse.com/suse/sle15
kubectl run -it --rm --restart=Never ubi7 --image=registry.access.redhat.com/ubi7/ubi
kubectl run -it --rm --restart=Never ubi8 --image=registry.access.redhat.com/ubi8/ubi
kubectl run -it --rm --restart=Never ubuntu-1804 --image=ubuntu:18.04
kubectl run -it --rm --restart=Never ubuntu-2004 --image=ubuntu:20.04
+ +

Create a long-lived pod

1
kubectl -n kube-system run fedora-32 --generator=run-pod/v1 --image=fedora:32 -- bash -c 'while true; do sleep 10; done'
+ +

Attach the long-lived pod

1
kubectl -n kube-system exec -it fedora-32 -- bash
+ +

Remove the long-lived pod

1
kubectl -n kube-system delete pod fedora-32
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/04/25/asgi-async-python-web-ecosystem/index.html b/2020/04/25/asgi-async-python-web-ecosystem/index.html new file mode 100644 index 00000000..a67316fd --- /dev/null +++ b/2020/04/25/asgi-async-python-web-ecosystem/index.html @@ -0,0 +1,260 @@ + + + + + + + + + + + + ASGI: Async Python Web Ecosystem | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ ASGI: Async Python Web Ecosystem +

+ +

ASGI: Async Python Web Ecosystem

There’s a lot of exciting stuff happening in the Python web development ecosystem right now — one of the main drivers of this endeavor is ASGI , the Asynchronous Server Gateway Interface.

+

An overview of ASGI

ASGI consists of two different components:

+
    +
  • A protocol server, which terminates sockets and translates them into connections and per-connection event messages.
  • +
  • An application, which lives inside a protocol server, is called once per connection, and handles event messages as they happen, emitting its own event messages back when necessary.
  • +
+

There are two separate parts to an ASGI connection:

+
    +
  • A connection scope, which represents a protocol connection to a user and survives until the connection closes.
  • +
  • Events, which are messages sent to the application as things happen on the connection, and messages sent back by the application to be received by the server, including data to be transmitted to the client.
  • +
+

The advantages of ASGI

There are many more advantages to using ASGI-based components for building Python web apps.

+
    +
  • Speed: the async nature of ASGI apps and servers make them really fast (for Python, at least) — we’re talking about 60k-70k req/s (consider that Flask and Django only achieve 10-20k in a similar situation).
  • +
  • Features: ASGI servers and frameworks gives you access to inherently concurrent features (WebSocket, Server-Sent Events, HTTP/2) that are impossible to implement using sync/WSGI.
  • +
  • Stability: ASGI as a spec has been around for about 3 years now, and version 3.0 is considered very stable. Foundational parts of the ecosystem are stabilizing as a result.
  • +
+

In terms of libraries and tooling, I don’t think we can say we’re there just yet. But thanks to a very active community, I have strong hopes that the ASGI ecosystem reaches feature parity with the traditional sync/WSGI ecosystem real soon.

+

ASGI protocol servers

    +
  • Hypercorn - Python 3.7+
  • +
  • Daphne - Python 3.5+
  • +
  • Uvicorn - Python 3.6+
  • +
+

Hypercorn

[Hypercorn] is an ASGI web server based on the sans-io hyper, h11, h2, and wsproto libraries and inspired by Gunicorn. Hypercorn supports HTTP/1, HTTP/2, WebSockets (over HTTP/1 and HTTP/2), ASGI/2, and ASGI/3 specifications. Hypercorn can utilise asyncio, uvloop, or trio worker types.

+

Hypercorn was initially part of Quart before being separated out into a standalone ASGI server. Hypercorn forked from version 0.5.0 of Quart.

+
1
pip install -U Hypercorn
+ +

Daphne

Daphne is a HTTP, HTTP2 and WebSocket protocol server for ASGI and ASGI-HTTP, developed to power Django Channels.

+
1
pip install -U daphne Twisted[tls,http2]
+ +

Uvicorn

Uvicorn is a lightning-fast ASGI server, built on uvloop and httptools.

+

Uvicorn currently supports HTTP/1.1 and WebSockets. Support for HTTP/2 is planned.

+
1
pip install -U uvicorn
+ +

ASGI frameworks

    +
  • Quart - 659
  • +
  • BlackSheep - 4
  • +
  • FastAPI
  • +
  • Sanic - 3168
  • +
  • Starlette - 4824
  • +
  • Django Channels - 7161
  • +
+

Quart

Quart is a Python ASGI web microframework. It is intended to provide the easiest way to use asyncio functionality in a web context, especially with existing Flask apps. This is possible as the Quart API is a superset of the Flask API.

+

Quart aims to be a complete web microframework, as it supports HTTP/1.1, HTTP/2 and websockets. Quart is very extendable and has a number of known extensions and works with many of the Flask extensions.

+

Also see this cheatsheet. To deploy in a production setting see the deployment documentation.

+
1
pip install -U Quart
+ +

BlackSheep

BlackSheep is an asynchronous web framework to build event based, non-blocking Python web applications.

+

BlackSheep belongs to the category of ASGI web frameworks, so it requires an ASGI HTTP server to run, such as uvicorn, daphne, or hypercorn.

+
1
pip install -U blacksheep hypercorn
+ +

FastAPI

FastAPI is a modern, fast (high-performance), web framework for building APIs with Python 3.6+ based on standard Python type hints.

+
1
pip install -U fastapi hypercorn
+ +

Sanic

Sanic is a Python 3.6+ web server and web framework that’s written to go fast. It allows the usage of the async/await syntax, which makes your code non-blocking and speedy.

+

Sanic has three serving options: the inbuilt webserver, an ASGI webserver, or gunicorn.

+
1
pip install -U sanic hypercorn
+ +

Starlette

Starlette is a lightweight ASGI framework/toolkit, which is ideal for building high performance asyncio services.

+
1
pip install -U starlette hypercorn
+ +

Django Channels

Channels augments Django to bring WebSocket, long-poll HTTP, task offloading and other async support to your code, using familiar Django design patterns and a flexible underlying framework that lets you not only customize behaviours but also write support for your own protocols and needs.

+

Django REST framework is a powerful and flexible toolkit for building Web APIs.

+
    +
  • The Web browsable API is a huge usability win for your developers.
  • +
  • Authentication policies including packages for OAuth1a and OAuth2.
  • +
  • Serialization that supports both ORM and non-ORM data sources.
  • +
  • Customizable all the way down - just use regular function-based views if you don’t need the more powerful features.
  • +
  • Extensive documentation, and great community support.
  • +
  • Used and trusted by internationally recognised companies including Mozilla, Red Hat, Heroku, and Eventbrite.
  • +
+
1
2
3
4
5
# python -m pip install -U Django
# python -m django --version
# python -c "import django; print(django.get_version())"
# python -c "import channels; print(channels.__version__)"
pip install -U Django channels djangorestframework django-filter markdown
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/05/01/quickly-generate-certificates-by-openssl/index.html b/2020/05/01/quickly-generate-certificates-by-openssl/index.html new file mode 100644 index 00000000..8cd75005 --- /dev/null +++ b/2020/05/01/quickly-generate-certificates-by-openssl/index.html @@ -0,0 +1,199 @@ + + + + + + + + + + + + Quickly generate certificates by OpenSSL | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Quickly generate certificates by OpenSSL +

+ +

Quickly generate certificates by OpenSSL

Build OpenSSL

1
2
3
4
5
6
7
cd /tmp
curl -sSL https://www.openssl.org/source/openssl-1.1.1g.tar.gz | tar -xvz
cd openssl-1.1.1g

./config --prefix=/usr --openssldir=/etc/pki/tls -fPIC no-shared
make -j2 LDFLAGS="-Wl,--strip-all"
make install
+ +

Check OpenSSL

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# openssl version
OpenSSL 1.1.1g 21 Apr 2020

# openssl version -a
OpenSSL 1.1.1g 21 Apr 2020
built on: Fri May 1 13:12:19 2020 UTC
platform: linux-x86_64
options: bn(64,64) rc4(16x,int) des(int) idea(int) blowfish(ptr)
compiler: gcc -fPIC -pthread -m64 -Wa,--noexecstack -Wall -O3 -fPIC -DOPENSSL_USE_NODELETE -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DRC4_ASM -DMD5_ASM -DAESNI_ASM -DVPAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DX25519_ASM -DPOLY1305_ASM -DNDEBUG
OPENSSLDIR: "/etc/pki/tls"
ENGINESDIR: "/usr/lib64/engines-1.1"
Seeding source: os-specific

echo | openssl s_client -connect www.feistyduck.com:443 -tls1_2 -servername www.feistyduck.com -reconnect 2>&1 | grep -E "^New|^Reused"

echo | openssl s_client -connect docs.python.org:443 -tls1_3 -servername docs.python.org -reconnect 2>&1 | grep -E "^New|^Reused"

# echo -e "GET /3/ HTTP/1.1\r\nConnection: close\r\nHost: docs.python.org\r\n\r\n" | openssl s_client -quiet -connect docs.python.org:443 -tls1_3 -servername docs.python.org
+ +

OpenSSL ciphers

1
2
3
4
5
6
7
8
9
10
# openssl ciphers -v | grep -E "^DHE-RSA-|^ECDHE-RSA-|^ECDHE-ECDSA-" | grep AEAD | sort
DHE-RSA-AES128-GCM-SHA256 TLSv1.2 Kx=DH Au=RSA Enc=AESGCM(128) Mac=AEAD
DHE-RSA-AES256-GCM-SHA384 TLSv1.2 Kx=DH Au=RSA Enc=AESGCM(256) Mac=AEAD
DHE-RSA-CHACHA20-POLY1305 TLSv1.2 Kx=DH Au=RSA Enc=CHACHA20/POLY1305(256) Mac=AEAD
ECDHE-ECDSA-AES128-GCM-SHA256 TLSv1.2 Kx=ECDH Au=ECDSA Enc=AESGCM(128) Mac=AEAD
ECDHE-ECDSA-AES256-GCM-SHA384 TLSv1.2 Kx=ECDH Au=ECDSA Enc=AESGCM(256) Mac=AEAD
ECDHE-ECDSA-CHACHA20-POLY1305 TLSv1.2 Kx=ECDH Au=ECDSA Enc=CHACHA20/POLY1305(256) Mac=AEAD
ECDHE-RSA-AES128-GCM-SHA256 TLSv1.2 Kx=ECDH Au=RSA Enc=AESGCM(128) Mac=AEAD
ECDHE-RSA-AES256-GCM-SHA384 TLSv1.2 Kx=ECDH Au=RSA Enc=AESGCM(256) Mac=AEAD
ECDHE-RSA-CHACHA20-POLY1305 TLSv1.2 Kx=ECDH Au=RSA Enc=CHACHA20/POLY1305(256) Mac=AEAD
+ +

Generate RSA-2048 certificate

1
2
3
4
5
6
7
8
9
10
11
openssl genrsa -out server.key 2048

openssl req -key server.key -x509 -days 7670 -out server.crt -subj '/CN=me' \
-addext "subjectAltName=DNS:example.com,DNS:*.example.com,IP:127.0.0.1,IP:::1" \
-addext "certificatePolicies=1.2.3.4"

openssl x509 -text -in server.crt | less
openssl rsa -in server.key -text -noout | less

openssl dsaparam -genkey 2048 | openssl dsa -out dsa.key
openssl dsa -in dsa.key -text -noout | less
+ +

Generate ECDSA certificate

1
2
3
4
5
6
7
8
9
10
11
12
13
14
export algorithm=secp521r1
export hash=sha512
export algorithm=secp384r1
export hash=sha384

openssl ecparam -genkey -out server-$algorithm.key -name $algorithm

openssl req -key server-$algorithm.key -subj '/CN=me' \
-new -x509 -${hash} -days 7670 -extensions v3_ca -out server-$algorithm.crt \
-addext "subjectAltName=DNS:example.com,DNS:*.example.com,DNS:*.example.net,IP:127.0.0.1,IP:::1"

openssl pkey -in server-$algorithm.key -text -noout
openssl x509 -in server-$algorithm.crt -text -noout
openssl x509 -purpose -in server-$algorithm.crt
+ +

Generate EdDSA certificate

1
2
3
4
5
6
7
8
9
10
11
12
export algorithm=ed448
export algorithm=ed25519

openssl genpkey -algorithm $algorithm -out server-$algorithm.key

openssl req -key server-$algorithm.key -subj '/CN=me' \
-new -x509 -days 7670 -extensions v3_ca -out server-$algorithm.crt \
-addext "subjectAltName=DNS:example.com,DNS:*.example.com,DNS:*.example.net,IP:127.0.0.1,IP:::1"

openssl pkey -in server-$algorithm.key -text -noout
openssl x509 -in server-$algorithm.crt -text -noout
openssl x509 -purpose -in server-$algorithm.crt
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/05/02/build-boost-on-windows/index.html b/2020/05/02/build-boost-on-windows/index.html new file mode 100644 index 00000000..3ab3e5fe --- /dev/null +++ b/2020/05/02/build-boost-on-windows/index.html @@ -0,0 +1,214 @@ + + + + + + + + + + + + Build Boost on Windows | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Build Boost on Windows +

+ +

Build Boost on Windows

Download Boost C++ Libraries

1
2
3
4
C:\>aria2c -c -m 0 -t 5 -j 8 -s 8 -x 8 -k 1m --file-allocation=none ^
https://dl.bintray.com/boostorg/release/1.73.0/source/boost_1_73_0.tar.gz

C:\>tar -xzf boost_1_73_0.tar.gz
+ +

Install Visual Studio Build Tools

Install Build Tools for Visual Studio 2019, then open x64 Native Tools Command Prompt for VS 2019.

+
1
2
3
4
5
C:\>cl
Microsoft (R) C/C++ Optimizing Compiler Version 19.26.28806 for x64
Copyright (C) Microsoft Corporation. All rights reserved.

usage: cl [ option... ] filename... [ /link linkoption... ]
+ +

Build and Install Boost.Build (b2)

    +
  1. Go to the directory tools\build\
  2. +
  3. Run bootstrap.bat
  4. +
  5. Run b2 install –prefix=PREFIX where PREFIX is the directory where you want Boost.Build to be installed
  6. +
  7. Add PREFIX\bin to your PATH environment variable.
  8. +
+
1
2
3
4
5
6
7
cd tools\build\

bootstrap.bat

b2 install --prefix=C:\opt\boost-build

SET PATH=C:\opt\boost-build\bin;%PATH%
+ +

Build Boost with Boost.Build (b2)

b2 configuration

1
2
3
4
5
6
7
8
9
10
11
https://boostorg.github.io/build/manual/master/index.html

--layout=versioned (static)
--layout=system (shared)

variant=debug,release
link=shared,static
threading=single,multi
runtime-link=shared,static
address-model=32,64
debug-symbols=on
+ +

b2 - combination

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
while read B2_LINK B2_VARIANT REST; do
echo b2 -j4 --layout=system \
--build-dir=..\\boost-build-x64-${B2_LINK}-${B2_VARIANT} \
--prefix=C:\\opt\\boost-x64-${B2_LINK}-${B2_VARIANT} \
link=${B2_LINK} variant=${B2_VARIANT} \
toolset=msvc runtime-link=shared threading=multi address-model=64 \
install
done << EOF
shared release
shared debug
static release
static debug
EOF

$ du -ms boost-x64-*
206 boost-x64-shared-debug
175 boost-x64-shared-release
691 boost-x64-static-debug
354 boost-x64-static-release
1426 boost-x64-*

$ (du -ms boost-x64; cd boost-x64; du -ms include/ lib/shared/* lib/static/*)
971 boost-x64
151 include/
56 lib/shared/debug
24 lib/shared/release
540 lib/static/debug
203 lib/static/release

1426 - 971 = 455 MB
+ +

b2 - static - release

1
2
3
4
b2 -j4 --layout=system ^
--build-dir=..\boost-build-x64-static-release ^
--prefix=C:\opt\boost-x64-static-release ^
toolset=msvc variant=release threading=multi link=static runtime-link=shared address-model=64 install
+ +

b2 - shared - release

1
2
3
4
b2 -j4 --layout=system ^
--build-dir=..\boost-build-x64-shared-release ^
--prefix=C:\opt\boost-x64-shared-release ^
toolset=msvc variant=release threading=multi link=shared runtime-link=shared address-model=64 install
+ +

original structure

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# BOOST_LIB_BUILDID, BOOST_ALL_NO_LIB, BOOST_AUTO_LINK_NOMANGLE, BOOST_LIB_DIAGNOSTIC

# 37,376
cl /MD /EHsc /DBOOST_ALL_NO_LIB=1 /I C:\opt\boost-x64-static-release\include makepasswd_boost.cpp ^
/link /LIBPATH:C:\opt\boost-x64-static-release\lib libboost_random.lib libboost_system.lib

# 37,376
cl /MD /EHsc /DBOOST_AUTO_LINK_SYSTEM /I C:\opt\boost-x64-static-release\include makepasswd_boost.cpp ^
/link /LIBPATH:C:\opt\boost-x64-static-release\lib

# 50,688
cl /MDd /EHsc /DBOOST_AUTO_LINK_SYSTEM /I C:\opt\boost-x64-static-debug\include makepasswd_boost.cpp ^
/link /LIBPATH:C:\opt\boost-x64-static-debug\lib

# 23,040
cl /MD /EHsc /DBOOST_ALL_NO_LIB=1 /I C:\opt\boost-x64-shared-release\include makepasswd_boost.cpp ^
/link /LIBPATH:C:\opt\boost-x64-shared-release\lib boost_random.lib boost_system.lib

# 23,040
cl /MD /EHsc /DBOOST_AUTO_LINK_NOMANGLE /I C:\opt\boost-x64-shared-release\include makepasswd_boost.cpp ^
/link /LIBPATH:C:\opt\boost-x64-shared-release\lib

# 29,184
cl /MDd /EHsc /DBOOST_AUTO_LINK_NOMANGLE /I C:\opt\boost-x64-shared-debug\include makepasswd_boost.cpp ^
/link /LIBPATH:C:\opt\boost-x64-shared-debug\lib
+ +

compact structure

1
2
3
boost-x64/include/boost/version.hpp
boost-x64/lib/static/release/boost_system.lib
boost-x64/lib/shared/debug/boost_system.lib
+ +
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# BOOST_LIB_BUILDID, BOOST_ALL_NO_LIB, BOOST_AUTO_LINK_NOMANGLE, BOOST_LIB_DIAGNOSTIC

# 23,040
cl /MD /EHsc /DBOOST_AUTO_LINK_NOMANGLE /I C:\opt\boost-x64\include makepasswd_boost.cpp ^
/link /LIBPATH:C:\opt\boost-x64\lib\shared\release

# 29,184
cl /MDd /EHsc /DBOOST_AUTO_LINK_NOMANGLE /I C:\opt\boost-x64\include makepasswd_boost.cpp ^
/link /LIBPATH:C:\opt\boost-x64\lib\shared\debug

# 37,376
cl /MD /EHsc /DBOOST_AUTO_LINK_SYSTEM /I C:\opt\boost-x64\include makepasswd_boost.cpp ^
/link /LIBPATH:C:\opt\boost-x64\lib\static\release

# 50,688
cl /MDd /EHsc /DBOOST_AUTO_LINK_SYSTEM /I C:\opt\boost-x64\include makepasswd_boost.cpp ^
/link /LIBPATH:C:\opt\boost-x64\lib\static\debug
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/05/03/ssh-proxy-and-forwarding/index.html b/2020/05/03/ssh-proxy-and-forwarding/index.html new file mode 100644 index 00000000..53eb557d --- /dev/null +++ b/2020/05/03/ssh-proxy-and-forwarding/index.html @@ -0,0 +1,204 @@ + + + + + + + + + + + + SSH Proxy and Forwarding | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ SSH Proxy and Forwarding +

+ +

SSH Proxy and Forwarding

SSH not only can be used as a SOCKS5 proxy to access the remote network, but also be used to do port forwarding from local to the given remote side, or vice versa.

+

SOCKS5 proxy to access the remote network

1
2
3
4
5
while true; do
date
ssh -C -N -T -D 4080 user@example.com
echo
done
+ +

SOCKS5 proxy to access the local network

1
2
3
4
5
while true; do
date
ssh -C -N -T -R 4080 user@example.com
echo
done
+ +

Forward local traffic to the remote side

1
2
3
4
5
while true; do
date
ssh -C -N -T -L 127.0.0.1:4080:192.168.121.121:80 user@example.com
echo
done
+ +

Forward remote traffic to the local side

1
2
3
4
5
while true; do
date
ssh -C -N -T -R 127.0.0.1:4080:10.20.30.40:80 user@example.com
echo
done
+ +

Cookbook

options

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
-4      Forces ssh to use IPv4 addresses only.
-6 Forces ssh to use IPv6 addresses only.

-C Requests compression of all data (including stdin, stdout, stderr, and data for forwarded X11, TCP and
UNIX-domain connections). The compression algorithm is the same used by gzip(1). Compression is desirable on
modem lines and other slow connections, but will only slow down things on fast networks. The default value can
be set on a host-by-host basis in the configuration files; see the Compression option.

-N Do not execute a remote command. This is useful for just forwarding ports.

-L [bind_address:]port:host:hostport
-L [bind_address:]port:remote_socket
-L local_socket:host:hostport
-L local_socket:remote_socket
Specifies that connections to the given TCP port or Unix socket on the local (client) host are to be forwarded
to the given host and port, or Unix socket, on the remote side. This works by allocating a socket to listen to
either a TCP port on the local side, optionally bound to the specified bind_address, or to a Unix socket. When‐
ever a connection is made to the local port or socket, the connection is forwarded over the secure channel, and
a connection is made to either host port hostport, or the Unix socket remote_socket, from the remote machine.

Port forwardings can also be specified in the configuration file. Only the superuser can forward privileged
ports. IPv6 addresses can be specified by enclosing the address in square brackets.

By default, the local port is bound in accordance with the GatewayPorts setting. However, an explicit
bind_address may be used to bind the connection to a specific address. The bind_address of “localhost” indi‐
cates that the listening port be bound for local use only, while an empty address or ‘*’ indicates that the port
should be available from all interfaces.

-R [bind_address:]port:host:hostport
-R [bind_address:]port:local_socket
-R remote_socket:host:hostport
-R remote_socket:local_socket
-R [bind_address:]port
Specifies that connections to the given TCP port or Unix socket on the remote (server) host are to be forwarded
to the local side.

This works by allocating a socket to listen to either a TCP port or to a Unix socket on the remote side. When‐
ever a connection is made to this port or Unix socket, the connection is forwarded over the secure channel, and
a connection is made from the local machine to either an explicit destination specified by host port hostport,
or local_socket, or, if no explicit destination was specified, ssh will act as a SOCKS 4/5 proxy and forward
connections to the destinations requested by the remote SOCKS client.

Port forwardings can also be specified in the configuration file. Privileged ports can be forwarded only when
logging in as root on the remote machine. IPv6 addresses can be specified by enclosing the address in square
brackets.

By default, TCP listening sockets on the server will be bound to the loopback interface only. This may be over‐
ridden by specifying a bind_address. An empty bind_address, or the address ‘*’, indicates that the remote
socket should listen on all interfaces. Specifying a remote bind_address will only succeed if the server's
GatewayPorts option is enabled (see sshd_config(5)).

If the port argument is ‘0’, the listen port will be dynamically allocated on the server and reported to the
client at run time. When used together with -O forward the allocated port will be printed to the standard out‐
put.

-X Enables X11 forwarding. This can also be specified on a per-host basis in a configuration file.

X11 forwarding should be enabled with caution. Users with the ability to bypass file permissions on the remote
host (for the user's X authorization database) can access the local X11 display through the forwarded connec‐
tion. An attacker may then be able to perform activities such as keystroke monitoring.

For this reason, X11 forwarding is subjected to X11 SECURITY extension restrictions by default. Please refer to
the ssh -Y option and the ForwardX11Trusted directive in ssh_config(5) for more information.

(Debian-specific: X11 forwarding is not subjected to X11 SECURITY extension restrictions by default, because too
many programs currently crash in this mode. Set the ForwardX11Trusted option to “no” to restore the upstream
behaviour. This may change in future depending on client-side improvements.)

-f Requests ssh to go to background just before command execution. This is useful if ssh is going to ask for pass‐
words or passphrases, but the user wants it in the background. This implies -n. The recommended way to start
X11 programs at a remote site is with something like ssh -f host xterm.

If the ExitOnForwardFailure configuration option is set to “yes”, then a client started with -f will wait for
all remote port forwards to be successfully established before placing itself in the background.

-n Redirects stdin from /dev/null (actually, prevents reading from stdin). This must be used when ssh is run in
the background. A common trick is to use this to run X11 programs on a remote machine. For example, ssh -n
shadows.cs.hut.fi emacs & will start an emacs on shadows.cs.hut.fi, and the X11 connection will be automatically
forwarded over an encrypted channel. The ssh program will be put in the background. (This does not work if ssh
needs to ask for a password or passphrase; see also the -f option.)
+ +

IPv4

Running a local SOCKS5 proxy on TCP port 4080, and forward connection is made from the remote machine on the TCP port 4022, to the local host TCP port 22.

+
1
2
3
4
5
while true; do
date
ssh -C -N -T -4 -D 4080 -R 127.0.0.1:4022:127.0.0.1:22 user@example.com
echo
done
+ +

IPv6

Running a local SOCKS5 proxy on TCP port 6080, and forward connection is made from the remote machine on the TCP port 6022, to the local host TCP port 22.

+
1
2
3
4
5
while true; do
date
ssh -C -N -T -6 -D 6080 -R [::1]:6022:[::1]:22 user@example.com
echo
done
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/09/05/zig-programming-language-quick-start/index.html b/2020/09/05/zig-programming-language-quick-start/index.html new file mode 100644 index 00000000..3f27bf51 --- /dev/null +++ b/2020/09/05/zig-programming-language-quick-start/index.html @@ -0,0 +1,356 @@ + + + + + + + + + + + + Zig Programming Language Quick Start | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Zig Programming Language Quick Start +

+ +

Zig Programming Language Quick Start

Introduction

Zig is a general-purpose programming language and toolchain for maintaining robust, optimal, and reusable software.

+
    +
  • Robust - behavior is correct even for edge cases such as out of memory.
  • +
  • Optimal - write programs the best way they can behave and perform.
  • +
  • Reusable - the same code works in many environments which have different constraints.
  • +
  • Maintainable - precisely communicate intent to the compiler and other programmers. The language imposes a low overhead to reading code and is resilient to changing requirements and environments.
  • +
+

Support Table

WebAssembly Support

+ + + + + + + + + + + + + + + + + + + + +
&nbsp;free standingemscriptenWASI
wasm32Tier 2Tier 3Tier 2
wasm64Tier 4Tier 4Tier 4
+

Tier System

Zig uses a Tier System to communicate the level of support for different targets.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
&nbsp;free standingLinux 3.16+macOS 10.13+Windows 8.1+FreeBSD 12.0+NetBSD 8.0+
x86_64Tier 1Tier 1Tier 2Tier 2Tier 2Tier 2
arm64Tier 1Tier 2N/ATier 3Tier 3Tier 3
arm32Tier 1Tier 2N/ATier 3Tier 3Tier 3
mips32 LETier 1Tier 2N/AN/ATier 3Tier 3
mips64Tier 3Tier 3N/AN/ATier 3Tier 3
riscv64Tier 1Tier 2N/AN/ATier 3Tier 3
bpfTier 3Tier 3N/AN/ATier 3Tier 3
s390xTier 3Tier 3N/AN/ATier 3Tier 3
powerpc64Tier 3Tier 3Tier 4N/ATier 3Tier 3
+

Documentation & Download

Documentation

+

Download

+

Targets

Zig supports generating code for all targets that LLVM supports.

+
1
2
3
4
5
6
7
8
9
10
$ zig targets

$ llc --version
$ llc -march=x86-64 -mattr=help
$ llc -march=riscv64 -mattr=help
$ llc -march=aarch64 -mattr=help
$ llc -march=mips -mattr=help
$ llc -march=arm -mattr=help
$ llc -march=wasm32 -mattr=help
$ llc -march=ppc64le -mattr=help
+ +

Hello World

1
2
3
4
5
6
7
8
$ cat << EOF > HelloWorld.zig
const std = @import("std");

pub fn main() !void {
const stdout = std.io.getStdOut().writer();
try stdout.print("Hello, {}!\n", .{"world"});
}
EOF
+ +

wasm32-wasi

1
2
3
4
5
6
7
8
# https://github.com/wasmerio/wasmer
# https://github.com/bytecodealliance/wasmtime
$ zig build-exe -target wasm32-wasi -O ReleaseSmall --strip HelloWorld.zig && wasmer HelloWorld.wasm && wasmtime HelloWorld.wasm
Hello, world!
Hello, world!
$ file HelloWorld.wasm && du -ks HelloWorld.wasm
HelloWorld.wasm: WebAssembly (wasm) binary module version 0x1 (MVP)
4 HelloWorld.wasm
+ +

x86_64-linux-gnu

1
2
3
4
5
6
7
8
9
10
11
12
13
$ zig build-exe HelloWorld.zig
$ ./HelloWorld
Hello, world!
$ du -ks HelloWorld
832 HelloWorld
$ file HelloWorld
HelloWorld: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, with debug_info, not stripped

$ zig build-exe -target x86_64-linux-gnu -mcpu core_avx2 -O ReleaseSmall -fPIC --strip HelloWorld.zig && ./HelloWorld
Hello, world!
$ file HelloWorld && du -ks HelloWorld
HelloWorld: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, not stripped
8 HelloWorld
+ +

mips-linux-gnu

1
2
3
4
5
6
7
8
9
10
$ zig build-exe -target mips-linux-gnu -mcpu mips32r2 -O ReleaseSmall --strip HelloWorld.zig && qemu-mips-static HelloWorld
$ file HelloWorld && du -ks HelloWorld
HelloWorld: ELF 32-bit MSB executable, MIPS, MIPS32 rel2 version 1 (SYSV), statically linked, not stripped
12 HelloWorld


$ zig build-exe -target mips-linux-gnu -mcpu mips32r6 -O ReleaseSmall --strip HelloWorld.zig && qemu-mips-static ./HelloWorld
$ file HelloWorld && du -ks HelloWorld
HelloWorld: ELF 32-bit MSB executable, MIPS, MIPS32 rel6 version 1 (SYSV), statically linked, not stripped
12 HelloWorld
+ +

arm-linux-gnueabihf

1
2
3
4
5
6
7
8
9
10
$ zig build-exe -target arm-linux-gnueabihf -mcpu arm1176jzf_s -O ReleaseSafe HelloWorld.zig  && qemu-arm-static ./HelloWorld
$ file HelloWorld && du -ks HelloWorld
HelloWorld: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, with debug_info, not stripped
780 HelloWorld


$ zig build-exe -target arm-linux-gnueabihf -mcpu cortex_a7 -O ReleaseSafe HelloWorld.zig && qemu-arm-static ./HelloWorld
$ file HelloWorld && du -ks HelloWorld
HelloWorld: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, with debug_info, not stripped
772 HelloWorld
+ +

aarch64-linux-gnu

1
2
3
4
5
$ zig build-exe -target aarch64-linux-gnu -mcpu cortex_a72 -O ReleaseSafe -fPIC  HelloWorld.zig && qemu-aarch64-static HelloWorld
Hello, world!
$ file HelloWorld && du -ks HelloWorld
HelloWorld: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, with debug_info, not stripped
596 HelloWorld
+ +

powerpc64le-linux-gnu

1
2
3
4
5
$ zig build-exe -target powerpc64le-linux-gnu -mcpu pwr9 -O ReleaseSafe -fPIC HelloWorld.zig && qemu-ppc64le-static HelloWorld
Hello, world!
$ file HelloWorld && du -ks HelloWorld
HelloWorld: ELF 64-bit LSB executable, 64-bit PowerPC or cisco 7500, version 1 (SYSV), statically linked, with debug_info, not stripped
632 HelloWorld
+ +

riscv64-linux-gnu

1
2
3
4
5
$ zig build-exe -target riscv64-linux-gnu -O ReleaseSafe HelloWorld.zig && qemu-riscv64-static HelloWorld
Hello, world!
$ file HelloWorld && du -ks HelloWorld
HelloWorld: ELF 64-bit LSB executable, UCB RISC-V, version 1 (SYSV), statically linked, with debug_info, not stripped
728 HelloWorld
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/09/12/sdxc-card-sd64g-on-raspberry-pi/index.html b/2020/09/12/sdxc-card-sd64g-on-raspberry-pi/index.html new file mode 100644 index 00000000..513121fc --- /dev/null +++ b/2020/09/12/sdxc-card-sd64g-on-raspberry-pi/index.html @@ -0,0 +1,195 @@ + + + + + + + + + + + + SDXC card SD64G on Raspberry Pi | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ SDXC card SD64G on Raspberry Pi +

+ +

SDXC card SD64G on Raspberry Pi

dmesg - mmc

1
2
3
4
5
6
7
8
9
10
11
12
$ dmesg  | grep mmc
[ 1.681001] sdhost-bcm2835 20202000.mmc: could not get clk, deferring probe
[ 2.583924] mmc0: sdhost-bcm2835 loaded - DMA enabled (>1)
[ 2.675452] mmc0: host does not support reading read-only switch, assuming write-enable
[ 2.691849] mmc0: new high speed SDXC card at address 5048
[ 2.701678] mmcblk0: mmc0:5048 SD64G 58.0 GiB
[ 2.712564] mmcblk0: p1 p2
[ 2.737917] EXT4-fs (mmcblk0p2): INFO: recovery required on readonly filesystem
[ 2.748359] EXT4-fs (mmcblk0p2): write access will be enabled during recovery
[ 2.888278] EXT4-fs (mmcblk0p2): recovery complete
[ 2.898848] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[ 12.148874] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
+ +

lsblk

1
2
3
4
5
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
mmcblk0 179:0 0 58G 0 disk
├─mmcblk0p1 179:1 0 256M 0 part /boot
└─mmcblk0p2 179:2 0 57.8G 0 part /
+ +

fdisk

1
2
3
4
5
6
7
8
9
10
11
$ sudo fdisk -l /dev/mmcblk0
Disk /dev/mmcblk0: 58 GiB, 62264442880 bytes, 121610240 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x8babfcf3

Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 8192 532479 524288 256M c W95 FAT32 (LBA)
/dev/mmcblk0p2 532480 121610239 121077760 57.8G 83 Linux
+ +

parted

1
2
3
4
5
6
7
8
9
10
pi@raspberrypi:~ $ sudo parted -l /dev/mmcblk0
Model: SD SD64G (sd/mmc)
Disk /dev/mmcblk0: 62.3GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number Start End Size Type File system Flags
1 4194kB 273MB 268MB primary fat32 lba
2 273MB 62.3GB 62.0GB primary ext4
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/11/01/realtek-rtl8152-based-usb-ethernet-adapter/index.html b/2020/11/01/realtek-rtl8152-based-usb-ethernet-adapter/index.html new file mode 100644 index 00000000..5b105bb0 --- /dev/null +++ b/2020/11/01/realtek-rtl8152-based-usb-ethernet-adapter/index.html @@ -0,0 +1,211 @@ + + + + + + + + + + + + Realtek RTL8152 Based USB Ethernet Adapter | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Realtek RTL8152 Based USB Ethernet Adapter +

+ +

Realtek RTL8152 Based USB Ethernet Adapter

dmesg

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# dmesg -w

[ 8640.849899] usb 2-2: new high-speed USB device number 4 using xhci_hcd
[ 8640.998148] usb 2-2: New USB device found, idVendor=214b, idProduct=7250, bcdDevice= 1.00
[ 8640.998152] usb 2-2: New USB device strings: Mfr=0, Product=1, SerialNumber=0
[ 8640.998154] usb 2-2: Product: USB2.0 HUB
[ 8640.999460] hub 2-2:1.0: USB hub found
[ 8640.999950] hub 2-2:1.0: 4 ports detected
[ 8641.285910] usb 2-2.1: new high-speed USB device number 5 using xhci_hcd
[ 8641.386819] usb 2-2.1: New USB device found, idVendor=0bda, idProduct=8152, bcdDevice=20.00
[ 8641.386822] usb 2-2.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 8641.386823] usb 2-2.1: Product: USB 10/100 LAN
[ 8641.386825] usb 2-2.1: Manufacturer: Realtek
[ 8641.386826] usb 2-2.1: SerialNumber: 00E04C3608EC
[ 8641.412053] usbcore: registered new interface driver r8152
[ 8641.417333] usbcore: registered new interface driver cdc_ether
[ 8641.502276] usb 2-2.1: reset high-speed USB device number 5 using xhci_hcd
[ 8641.638858] r8152 2-2.1:1.0: skip request firmware
[ 8641.666572] r8152 2-2.1:1.0 eth0: v1.11.11
[ 8641.707491] r8152 2-2.1:1.0 enx00e04c3608ec: renamed from eth0
+ +

ifconfig

1
2
3
4
5
6
7
# ifconfig enx00e04c3608ec
enx00e04c3608ec: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 00:e0:4c:36:08:ec txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
+ +

ethtool

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# ethtool enx00e04c3608ec
Settings for enx00e04c3608ec:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Supported pause frame use: No
Supports auto-negotiation: Yes
Supported FEC modes: Not reported
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Advertised pause frame use: Symmetric Receive-only
Advertised auto-negotiation: Yes
Advertised FEC modes: Not reported
Speed: 10Mb/s
Duplex: Half
Port: MII
PHYAD: 32
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: pumbg
Wake-on: g
Current message level: 0x00007fff (32767)
drv probe link timer ifdown ifup rx_err tx_err tx_queued intr tx_done rx_status pktdata hw wol
Link detected: no
+ +
1
2
3
4
5
6
7
8
9
10
11
# ethtool -i enx00e04c3608ec
driver: r8152
version: v1.11.11
firmware-version:
expansion-rom-version:
bus-info: usb-0000:00:14.0-2.1
supports-statistics: yes
supports-test: no
supports-eeprom-access: no
supports-register-dump: no
supports-priv-flags: no
+ +
1
2
3
4
5
6
7
8
# ethtool -T enx00e04c3608ec
Time stamping parameters for enx00e04c3608ec:
Capabilities:
software-receive (SOF_TIMESTAMPING_RX_SOFTWARE)
software-system-clock (SOF_TIMESTAMPING_SOFTWARE)
PTP Hardware Clock: none
Hardware Transmit Timestamp Modes: none
Hardware Receive Filter Modes: none
+ +

hwinfo

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
  net interface: name = enx00e04c3608ec, path = /class/net/enx00e04c3608ec
type = 1
carrier = 0
hw_addr = 00:e0:4c:36:08:ec
net device: path = /devices/pci0000:00/0000:00:14.0/usb2/2-2/2-2.1/2-2.1:1.0
net driver: name = r8152, path = /bus/usb/drivers/r8152

37: USB 00.0: 0200 Ethernet controller
[Created at usb.122]
Unique ID: WFGf.TaH2R0dMoZ8
Parent ID: hSuP.V+vVO9032M2
SysFS ID: /devices/pci0000:00/0000:00:14.0/usb2/2-2/2-2.1/2-2.1:1.0
SysFS BusID: 2-2.1:1.0
Hardware Class: network
Model: "Realtek RTL8152 Fast Ethernet Adapter"
Hotplug: USB
Vendor: usb 0x0bda "Realtek Semiconductor Corp."
Device: usb 0x8152 "RTL8152 Fast Ethernet Adapter"
Revision: "20.00"
Serial ID: "00E04C3608EC"
Driver: "r8152"
Driver Modules: "r8152"
Device File: enx00e04c3608ec
Speed: 480 Mbps
HW Address: 00:e0:4c:36:08:ec
Permanent HW Address: 00:e0:4c:36:08:ec
Link detected: no
Module Alias: "usb:v0BDAp8152d2000dc00dsc00dp00icFFiscFFip00in00"
Driver Info #0:
Driver Status: r8152 is active
Driver Activation Cmd: "modprobe r8152"
Config Status: cfg=new, avail=yes, need=no, active=unknown
Attached to: #39 (Hub)

52: None 00.0: 10701 Ethernet
[Created at net.126]
Unique ID: GeD9.ndpeucax6V1
Parent ID: WFGf.TaH2R0dMoZ8
SysFS ID: /class/net/enx00e04c3608ec
SysFS Device Link: /devices/pci0000:00/0000:00:14.0/usb2/2-2/2-2.1/2-2.1:1.0
Hardware Class: network interface
Model: "Ethernet network interface"
Driver: "r8152"
Driver Modules: "r8152"
Device File: enx00e04c3608ec
HW Address: 00:e0:4c:36:08:ec
Permanent HW Address: 00:e0:4c:36:08:ec
Link detected: no
Config Status: cfg=new, avail=yes, need=no, active=unknown
Attached to: #37 (Ethernet controller)
+ +

lsusb

1
2
3
4
5
6
7
8
9
# lsusb
Bus 001 Device 002: ID 8087:8000 Intel Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 002 Device 003: ID 0c45:64d2 Microdia Integrated Webcam
Bus 002 Device 005: ID 0bda:8152 Realtek Semiconductor Corp. RTL8152 Fast Ethernet Adapter
Bus 002 Device 004: ID 214b:7250 USB2.0 HUB
Bus 002 Device 002: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
+ +

usb-devices

1
2
3
4
5
6
7
$ usb-devices | awk '/214b/' RS=
T: Bus=02 Lev=01 Prnt=01 Port=01 Cnt=02 Dev#= 4 Spd=480 MxCh= 4
D: Ver= 2.00 Cls=09(hub ) Sub=00 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=214b ProdID=7250 Rev=01.00
S: Product=USB2.0 HUB
C: #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=100mA
I: If#=0x0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub
+ +
1
2
3
4
5
6
7
8
9
$ usb-devices | awk '/0bda/' RS=
T: Bus=02 Lev=02 Prnt=04 Port=00 Cnt=01 Dev#= 5 Spd=480 MxCh= 0
D: Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 2
P: Vendor=0bda ProdID=8152 Rev=20.00
S: Manufacturer=Realtek
S: Product=USB 10/100 LAN
S: SerialNumber=00E04C3608EC
C: #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr=100mA
I: If#=0x0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=00 Driver=r8152
+ +

lsusb verbose

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# lsusb -v -d 0bda:8152
Bus 002 Device 005: ID 0bda:8152 Realtek Semiconductor Corp. RTL8152 Fast Ethernet Adapter
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.10
bDeviceClass 0
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x0bda Realtek Semiconductor Corp.
idProduct 0x8152 RTL8152 Fast Ethernet Adapter
bcdDevice 20.00
iManufacturer 1 Realtek
iProduct 2 USB 10/100 LAN
iSerial 3 00E04C3608EC
bNumConfigurations 2
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 0x0027
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xa0
(Bus Powered)
Remote Wakeup
MaxPower 100mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 3
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 255 Vendor Specific Subclass
bInterfaceProtocol 0
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83 EP 3 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0002 1x 2 bytes
bInterval 8
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 0x0050
bNumInterfaces 2
bConfigurationValue 2
iConfiguration 0
bmAttributes 0xa0
(Bus Powered)
Remote Wakeup
MaxPower 100mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 2 Communications
bInterfaceSubClass 6 Ethernet Networking
bInterfaceProtocol 0
iInterface 5 CDC Communications Control
CDC Header:
bcdCDC 1.10
CDC Union:
bMasterInterface 0
bSlaveInterface 1
CDC Ethernet:
iMacAddress 3 00E04C3608EC
bmEthernetStatistics 0x00000000
wMaxSegmentSize 1514
wNumberMCFilters 0x0000
bNumberPowerFilters 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83 EP 3 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0010 1x 16 bytes
bInterval 8
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 0
bInterfaceClass 10 CDC Data
bInterfaceSubClass 0
bInterfaceProtocol 0
iInterface 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 1
bNumEndpoints 2
bInterfaceClass 10 CDC Data
bInterfaceSubClass 0
bInterfaceProtocol 0
iInterface 4 Ethernet Data
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Binary Object Store Descriptor:
bLength 5
bDescriptorType 15
wTotalLength 0x000c
bNumDeviceCaps 1
USB 2.0 Extension Device Capability:
bLength 7
bDescriptorType 16
bDevCapabilityType 2
bmAttributes 0x00000002
HIRD Link Power Management (LPM) Supported
can't get debug descriptor: Resource temporarily unavailable
Device Status: 0x0000
(Bus Powered)
+ +
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# lsusb -v -d 214b:7250
Bus 002 Device 004: ID 214b:7250 USB2.0 HUB
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 9 Hub
bDeviceSubClass 0
bDeviceProtocol 1 Single TT
bMaxPacketSize0 64
idVendor 0x214b
idProduct 0x7250
bcdDevice 1.00
iManufacturer 0
iProduct 1 USB2.0 HUB
iSerial 0
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 0x0019
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xe0
Self Powered
Remote Wakeup
MaxPower 100mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 9 Hub
bInterfaceSubClass 0
bInterfaceProtocol 0 Full speed (or root) hub
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0001 1x 1 bytes
bInterval 12
Hub Descriptor:
bLength 9
bDescriptorType 41
nNbrPorts 4
wHubCharacteristic 0x00e0
Ganged power switching
Ganged overcurrent protection
TT think time 32 FS bits
Port indicators
bPwrOn2PwrGood 50 * 2 milli seconds
bHubContrCurrent 100 milli Ampere
DeviceRemovable 0x00
PortPwrCtrlMask 0xff
Hub Port Status:
Port 1: 0000.0503 highspeed power enable connect
Port 2: 0000.0100 power
Port 3: 0000.0100 power
Port 4: 0000.0100 power
Device Qualifier (for other device speed):
bLength 10
bDescriptorType 6
bcdUSB 2.00
bDeviceClass 9 Hub
bDeviceSubClass 0
bDeviceProtocol 0 Full speed (or root) hub
bMaxPacketSize0 64
bNumConfigurations 1
can't get debug descriptor: Resource temporarily unavailable
Device Status: 0x0003
Self Powered
Remote Wakeup Enabled
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/11/07/multicast-dns-mdns/index.html b/2020/11/07/multicast-dns-mdns/index.html new file mode 100644 index 00000000..9c81cd10 --- /dev/null +++ b/2020/11/07/multicast-dns-mdns/index.html @@ -0,0 +1,246 @@ + + + + + + + + + + + + Multicast DNS (mDNS) | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Multicast DNS (mDNS) +

+ +

Multicast DNS (mDNS)

Overview

+

Multicast DNS (mDNS) is a way of using familiar DNS programming interfaces, packet formats and operating semantics, in a small network where no conventional DNS server has been installed.

+

Multicast DNS (mDNS) is a joint effort by participants of the IETF Zero Configuration Networking (zeroconf) and DNS Extensions (dnsext) working groups. The requirements are driven by the Zeroconf working group; the implementation details are a chartered work item for the DNSEXT group. Most of the people working on mDNS are active participants of both working groups.

+

Multicast DNS (mDNS) provides the ability to perform DNS-like operations on the local link in the absence of any conventional Unicast DNS server. In addition, Multicast DNS designates a portion of the DNS namespace to be free for local use, without the need to pay any annual fee, and without the need to set up delegations or otherwise configure a conventional DNS server to answer for those names.

+

The primary benefits of Multicast DNS are that:

+
    +
  • mDNS require little or no administration or configuration to set them up
  • +
  • mDNS work when no infrastructure is present
  • +
  • mDNS work during infrastructure failures
  • +
+

Avahi is a free Zero-configuration networking (zeroconf) implementation, including a system for multicast DNS/DNS-SD service discovery. It allows programs to publish and discover services and hosts running on a local network with no specific configuration.

+

Protocol overview

When an mDNS client needs to resolve a hostname, it sends an IP multicast query message that asks the host having that name to identify itself. That target machine then multicasts a message that includes its IP address. All machines in that subnet can then use that information to update their mDNS caches. Any host can relinquish its claim to a name by sending a response packet with a time to live (TTL) equal to zero.

+

By default, mDNS exclusively resolves hostnames ending with the .local top-level domain. This can cause problems if .local includes hosts that do not implement mDNS but that can be found via a conventional unicast DNS server. Resolving such conflicts requires network-configuration changes that mDNS was designed to avoid.

+

Packet structure

An mDNS message is a multicast UDP packet sent using the following addressing:

+
    +
  • IPv4 address 224.0.0.251 or IPv6 address ff02::fb
  • +
  • UDP port 5353
  • +
  • When using Ethernet frames, the standard IP multicast MAC address 01:00:5E:00:00:FB (for IPv4) or 33:33:00:00:00:FB (for IPv6)
  • +
+

The payload structure is based on the unicast DNS packet format, consisting of two parts — the header and the data.

+

The header is identical to that found in unicast DNS, as are the sub-sections in the data part: queries, answers, authoritative-nameservers, and additional records. The number of records in each sub-section matches the value of the corresponding COUNT field in the header.

+

Install Avahi

1
2
3
4
5
$ sudo apt-get install -y --no-install-recommends avahi-daemon libnss-mdns

$ dig -p 5353 @ff02::fb OP-7020-01.local aaaa
$ dig -p 5353 @224.0.0.251 OP-7020-01.local
$ dig -p 5353 @224.0.0.251 OP-7020-01.local aaaa
+ +

Using Avahi

Hostname resolution

Avahi provides local hostname resolution using a “hostname.local” naming scheme. To enable it, install the nss-mdns package and start avahi-daemon.service.

+

Then, edit the file /etc/nsswitch.conf and change the hosts line to include mdns_minimal [NOTFOUND=return] before dns:

+
1
2
3
4
5
6
$ sudo vi /etc/nsswitch.conf

# mdns_minimal: IPv6 and IPv4, may slowdowns in resolving .local hosts
# mdns4_minimal: IPv4 only
# mdns6_minimal: IPv6 only
hosts: files mdns_minimal [NOTFOUND=return] dns myhostname
+ +

Configuring mDNS for custom TLD

The mdns_minimal module handles queries for the .local TLD only. Note the [NOTFOUND=return], which specifies that if mdns_minimal cannot find *.local, it will not continue to search for it in dns, myhostname, etc.

+

In case you want Avahi to support other TLDs, you should:

+
    +
  • replace mdns_minimal [NOTFOUND=return] with the full mdns module. There also are IPv4-only and IPv6-only modules mdns[46](_minimal)
  • +
  • customize /etc/avahi/avahi-daemon.conf with the domain-name of your choice
  • +
  • whitelist Avahi custom TLDs in /etc/mdns.allow
  • +
+

Avahi services discover tools

Avahi includes several utilities which help you discover the services running on a network. For example, run

+
1
2
3
$ sudo apt-get install -y --no-install-recommends avahi-utils
$ avahi-browse --all --resolve --terminate
$ avahi-browse --all --ignore-local --resolve --terminate
+ +

to discover services in your network.

+

Adding services to Avahi

The Avahi mDNS/DNS-SD daemon advertises the services whose *.service files are found in /etc/avahi/services/. Files in this directory must be readable by the avahi user/group. See avahi.service(5) for more details.

+

Firewall

Be sure to open UDP port 5353 if you’re using a firewall.

+

Windows

Windows 10 may not discover services by IPv4, but IPv6 works:

+
1
2
3
4
5
6
7
8
9
10
11
12
PS C:\> ping -6 raspberrypi.local

Pinging raspberrypi.local [2409:8a55:8ba:fb20:e010:9723:cb71:a0cb] with 32 bytes of data:
Reply from 2409:8a55:8ba:fb20:e010:9723:cb71:a0cb: time=5ms
Reply from 2409:8a55:8ba:fb20:e010:9723:cb71:a0cb: time=9ms
Reply from 2409:8a55:8ba:fb20:e010:9723:cb71:a0cb: time=13ms
Reply from 2409:8a55:8ba:fb20:e010:9723:cb71:a0cb: time=4ms

Ping statistics for 2409:8a55:8ba:fb20:e010:9723:cb71:a0cb:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 4ms, Maximum = 13ms, Average = 7ms
+ +

Windows 10 handles both hostname and hostname.local identically: it simultaneously tries LLMNR for the bare hostname, NetBIOS for the bare hostname, and (optionally) mDNS for hostname.local.

+

To activate the mDNS support, you have to Turn off the Link Local Multicast Name Resolution (LLMNR), i.e. set the EnableMulticast registry value to 0 (0: Disable LLMNR, 1: Use LLMNR):

+
1
2
3
4
5
6
7
8
9
10
11
12
13
PS C:\> netsh dnsclient show state
PS C:\> resolve-dnsname OP-7020-01.local -LlmnrOnly

PS C:\> reg delete "HKLM\Software\Policies\Microsoft\Windows NT\DNSClient" /v EnableMulticast /f
The operation completed successfully.

PS C:\> reg add "HKLM\Software\Policies\Microsoft\Windows NT\DNSClient" /v EnableMulticast /t REG_DWORD /d 0 /f
The operation completed successfully.

PS C:\> reg query "HKLM\Software\Policies\Microsoft\Windows NT\DNSClient"

HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows NT\DNSClient
EnableMulticast REG_DWORD 0x0
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/11/08/wireguard-on-raspberry-pi/index.html b/2020/11/08/wireguard-on-raspberry-pi/index.html new file mode 100644 index 00000000..cd88ae7b --- /dev/null +++ b/2020/11/08/wireguard-on-raspberry-pi/index.html @@ -0,0 +1,215 @@ + + + + + + + + + + + + WireGuard on Raspberry Pi | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ WireGuard on Raspberry Pi +

+ +

WireGuard on Raspberry Pi

Kernel Requirements

WireGuard requires Linux kernel version ≥3.10, with the following configuration options, which are likely already configured in your kernel, especially if you’re installing via distribution packages.

+
    +
  • CONFIG_NET for basic networking support
  • +
  • CONFIG_INET for basic IP support
  • +
  • CONFIG_NET_UDP_TUNNEL for sending and receiving UDP packets
  • +
  • CONFIG_CRYPTO_ALGAPI for crypto_xor
  • +
+

Raspberry Pi use Linux kernel version 5.4:

+
1
2
3
4
5
6
# cat /proc/version
Linux version 5.4.72+ (dom@buildbot) (gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)) #1356 Thu Oct 22 13:56:00 BST 2020

# dpkg -l | grep raspberrypi-kernel
ii raspberrypi-kernel 1.20201022-1 armhf Raspberry Pi bootloader
ii raspberrypi-kernel-headers 1.20201022-1 armhf Header files for the Raspberry Pi Linux kernel
+ +

Step 1: Install the toolchain

1
2
3
$ sudo apt-get install -y raspberrypi-kernel raspberrypi-kernel-headers \
iptables nftables \
libelf-dev build-essential pkg-config
+ +

Step 2: Grab the code

1
2
$ git clone https://git.zx2c4.com/wireguard-linux-compat
$ git clone https://git.zx2c4.com/wireguard-tools
+ +

Step 3: Compile and install the module

1
2
3
4
5
6
7
8
9
10
11
12
13
$ make -C wireguard-linux-compat/src -j$(nproc)
$ sudo make -C wireguard-linux-compat/src install

make: Entering directory '/tmp/wireguard-linux-compat/src'
INSTALL /tmp/wireguard-linux-compat/src/wireguard.ko
DEPMOD 5.4.72+
depmod -b "/" -a 5.4.72+

$ sudo modprobe wireguard
$ dmesg

[38626.469261] wireguard: WireGuard 1.0.20200908-3-gda5646f loaded. See www.wireguard.com for information.
[38626.469283] wireguard: Copyright (C) 2015-2019 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
+ +

Step 4: Compile and install the wg(8) tool

1
2
3
4
5
6
7
8
9
10
11
$ make -C wireguard-tools/src -j$(nproc)
$ sudo make -C wireguard-tools/src install

'wg' -> '/usr/bin/wg'
'man/wg.8' -> '/usr/share/man/man8/wg.8'
'completion/wg.bash-completion' -> '/usr/share/bash-completion/completions/wg'
'wg-quick/linux.bash' -> '/usr/bin/wg-quick'
'man/wg-quick.8' -> '/usr/share/man/man8/wg-quick.8'
'completion/wg-quick.bash-completion' -> '/usr/share/bash-completion/completions/wg-quick'
'systemd/wg-quick.target' -> '/lib/systemd/system/wg-quick.target'
'systemd/wg-quick@.service' -> '/lib/systemd/system/wg-quick@.service'
+ +

Step 5: Key generation

1
$ wg genkey | tee wg-privatekey | wg pubkey > wg-publickey
+ +

Step 6: Local configuration

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$ sudo vi /etc/wireguard/wg0.conf

[Interface]
PrivateKey = 4PlDEwG+60kuuEfDguXS/r7k+wUP4gQzeVCgJXLUOlI=
Address = 192.168.20.5/24
ListenPort = 64741
DNS = 8.8.8.8,8.8.4.4

[Peer]
PublicKey = r0SXjeVxqcTy7p1Ikau5XGd5eGPHciUejrTGtUL4Vh0=
AllowedIPs = 0.0.0.0/0
Endpoint = 1.2.3.4:64741
PersistentKeepalive = 25

$ qrencode -t png -o ipv4-tunnel-by-ipv4.png < ipv4-tunnel-by-ipv4.conf
+ +

Step 7: Peer configuration

1
2
3
4
5
6
7
8
9
10
11
12
$ sudo vi /etc/wireguard/wg0.conf

[Interface]
PrivateKey = uC40eSTd0GgKN9KWN4FEMlIDqx08hvf3m4HkPm7yNU0=
ListenPort = 64741
Address = 192.168.20.1/24

# Raspberry Pi Zero
[Peer]
PublicKey = RC/jDAB2ZkOon76ItDgYYBcFEhWByvjENk71cg8LoiM=
AllowedIPs = 192.168.20.5/32
PersistentKeepalive = 25
+ +

Step 8: Set up the peer interface

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# wg-quick up wg0

sysctl net.ipv4.tcp_fin_timeout=15
sysctl net.ipv4.tcp_keepalive_intvl=75
sysctl net.ipv4.ip_forward=1
sysctl net.ipv6.conf.all.forwarding=1
sysctl net.ipv4.conf.ens3.forwarding=1
sysctl net.ipv6.conf.ens3.forwarding=1

iptables -t filter -P INPUT ACCEPT
iptables -t filter -P FORWARD ACCEPT
iptables -t filter -P OUTPUT ACCEPT
iptables -t filter -F
iptables -t filter -X
iptables -t nat -F
iptables -t nat -X

$ cat << EOF | sudo iptables-restore
*filter
:INPUT ACCEPT
:FORWARD ACCEPT
:OUTPUT ACCEPT
COMMIT
*nat
:PREROUTING ACCEPT
:INPUT ACCEPT
:OUTPUT ACCEPT
:POSTROUTING ACCEPT
-A POSTROUTING -p esp -j RETURN
-A POSTROUTING -s 10.20.30.0/24 -o ens3 -j MASQUERADE
-A POSTROUTING -s 10.20.40.0/24 -o ens3 -j MASQUERADE
-A POSTROUTING -s 192.168.0.0/16 -o ens3 -j MASQUERADE
COMMIT
EOF

+ +

Step 9: Connect to peers

1
2
3
4
5
6
7
8
$ sudo wg-quick up wg0
$ sudo wg

$ sudo sysctl -w net.ipv4.ip_forward=1
$ sudo sysctl -w net.ipv6.conf.all.forwarding=1
$ sudo ip rule list
$ sudo ip route show table 0
$ sudo ip route show table all
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/11/14/usb-to-ttl-ch340/index.html b/2020/11/14/usb-to-ttl-ch340/index.html new file mode 100644 index 00000000..bd83bda5 --- /dev/null +++ b/2020/11/14/usb-to-ttl-ch340/index.html @@ -0,0 +1,223 @@ + + + + + + + + + + + + USB to TTL - CH340 | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ USB to TTL - CH340 +

+ +

USB to TTL - CH340

Introduction

在某宝买了一个 USB 转 TTL 模块,芯片型号是 CH340,芯片厂家是南京沁恒微电子股份有限公司。 +产品介绍,驱动程序,技术手册和原理图页面位于USB转串口芯片:CH340

+

USB to Serial Port Chips

USB 转串口芯片

+

Interface conversion expert

接口转换专家

+

Linux

进入 Linux 系统,将这个 USB 转 TTL 模块插入 USB A 口后自动识别。

+

dmesg

1
2
3
4
5
6
7
8
9
10
11
$ dmesg -w
[ 160.990615] usb 2-6: new full-speed USB device number 4 using xhci_hcd
[ 161.139926] usb 2-6: New USB device found, idVendor=1a86, idProduct=7523, bcdDevice= 2.64
[ 161.139932] usb 2-6: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[ 161.139934] usb 2-6: Product: USB Serial
[ 161.165466] usbcore: registered new interface driver usbserial_generic
[ 161.165513] usbserial: USB Serial support registered for generic
[ 161.167670] usbcore: registered new interface driver ch341
[ 161.167684] usbserial: USB Serial support registered for ch341-uart
[ 161.167703] ch341 2-6:1.0: ch341-uart converter detected
[ 161.168611] usb 2-6: ch341-uart converter now attached to ttyUSB0
+ +

lsusb

1
2
3
4
5
6
7
8
$ lsusb
Bus 001 Device 002: ID 8087:8000 Intel Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 002 Device 004: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter
Bus 002 Device 003: ID 0c45:64d2 Microdia Integrated Webcam
Bus 002 Device 002: ID 1d57:0008 Xenta 2.4G Wireless Optical Mouse
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
+ +

udev rules

1
2
3
4
5
6
7
8
udev /dev/ttyCH340

KERNEL=="ttyUSB*",\
ATTRS{idVendor}=="1a86",\
ATTRS{idProduct}=="7523",\
GROUP="dialout",\
MODE="0660",\
RUN+="/bin/ln -sf %k /dev/ttyCH340"
+ +

terminal emulation program

1
2
3
4
5
6
7
8
9
$ sudo screen /dev/ttyUSB0 115200

$ sudo busybox microcom -t 5000 -s 115200 -X /dev/ttyUSB0

$ sudo tio -b 115200 -t /dev/ttyUSB0

$ sudo picocom -b 115200 /dev/ttyUSB0

$ sudo minicom -b 115200 -8 -D /dev/ttyUSB0
+ +

pySerial

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
$ sudo apt-get install -y python3-serial

$ sudo python3 -m serial.tools.list_ports
/dev/ttyUSB0
1 ports found

$ sudo python3
Python 3.8.5 (default, Jul 28 2020, 12:59:40)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import serial
>>>
>>> ser = serial.Serial('/dev/ttyUSB0', 115200)
>>> ser.timeout = 3
>>> ser.write(b'xyz123abc')
9
>>> ser.read(8)
b'xyz123ab'
>>> ser.read(8)
b'c'
>>>
+ +
1
2
3
4
5
6
7
8
9
10
11
import serial
from serial.tools import list_ports

ports = list_ports.comports()
for port in ports:
print(port)

ser = serial.Serial('/dev/ttyUSB0', 115200)
ser.timeout = 3
ser.write(b'xyz123abc')
ser.read(8)
+ +

Windows

驱动程序

USB转串口芯片:CH340页面,厂家提供了 WHQL 驱动下载,支持主流 Windows 系统。

+

进入 Windows 系统,将这个 USB 转 TTL 模块插入 USB A 口,安装厂家提供的驱动程序。然后在设备管理器中的**端口(COM 和 LPT)**设备分类下,可以看到设备 **USB-SERIAL CH340 (COM11)**。

+

查看这个设备的属性,可以发现驱动程序是由 Microsoft Windows Hardware Compatibility Publisher 签名,提供商是 wch.cn,驱动程序日期是 2019/1/30,版本是 3.5.2019.1,驱动程序文件是 C:\Windows\System32\Drivers\CH341S64.SYS

+

设备信息

在设备的详细信息页面中,可以看到如下在 USB-IF 注册的属性:

+
1
2
3
4
5
QinHeng Electronics HL-340 USB-Serial adapter
USB-SERIAL CH340
USB\VID_1A86&PID_7523\5&3B489C26&0&6
USB\VID_1A86&PID_7523&REV_0264
USB\VID_1A86&PID_7523
+ +

pySerial

+
1
2
3
4
5
6
7
8
9
10
11
12
13
PS C:\> python -m pip install pyserial
PS C:\> python -m serial.tools.list_ports
COM11
1 ports found

PS C:\> python -m serial.tools.list_ports -v
COM11
desc: USB-SERIAL CH340 (COM11)
hwid: USB VID:PID=1A86:7523 SER=5 LOCATION=1-6
1 ports found

PS C:\> python -m serial.tools.miniterm -h
PS C:\> python -m serial.tools.miniterm COM11 115200
+ +
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
PS C:\> python
Python 3.8.6 (tags/v3.8.6:db45529, Sep 23 2020, 15:52:53) [MSC v.1927 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import serial
>>> from serial.tools import list_ports
>>> ports = list_ports.comports()
>>> for port in ports:
... print(port)
...
COM11 - USB-SERIAL CH340 (COM11)
>>> with serial.Serial('COM11', 19200, timeout=1) as ser:
... ser.write(b'hello')
... ser.read(5)
...
5
b'hello'
>>>
+ +
1
2
3
4
5
6
7
8
9
10
import serial
from serial.tools import list_ports

ports = list_ports.comports()
for port in ports:
print(port)

with serial.Serial('COM11', 19200, timeout=1) as ser:
ser.write(b'hello')
ser.read(5)
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/11/14/usb-to-ttl-ch340/interface_conversion_expert.png b/2020/11/14/usb-to-ttl-ch340/interface_conversion_expert.png new file mode 100644 index 00000000..bd377d8e Binary files /dev/null and b/2020/11/14/usb-to-ttl-ch340/interface_conversion_expert.png differ diff --git a/2020/11/14/usb-to-ttl-ch340/usb_serial_converter.png b/2020/11/14/usb-to-ttl-ch340/usb_serial_converter.png new file mode 100644 index 00000000..55c64dc5 Binary files /dev/null and b/2020/11/14/usb-to-ttl-ch340/usb_serial_converter.png differ diff --git a/2020/11/15/realtek-rtl8761b-based-bluetooth-adapter/index.html b/2020/11/15/realtek-rtl8761b-based-bluetooth-adapter/index.html new file mode 100644 index 00000000..fd11c436 --- /dev/null +++ b/2020/11/15/realtek-rtl8761b-based-bluetooth-adapter/index.html @@ -0,0 +1,301 @@ + + + + + + + + + + + + Realtek RTL8761B based Bluetooth adapter | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Realtek RTL8761B based Bluetooth adapter +

+ +

Realtek RTL8761B based Bluetooth adapter

General Specification

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
&nbsp;&nbsp;
Chip SetRealtek RTL8761B
Product IDFSC-BT836B
Dimension13mm x 26.9mm x 2mm
Bluetooth SpecificationBluetooth V5.0 (Dual Mode)
Power Supply3.3 Volt DC
Output Power10 dBm (Class 1.5)
Sensitivity-94.5dBm@0.1%BER
Frequency Band2.402 GHz ~ 2.480 GHz ISM band
ModulationFHSS,GFSK,DPSK,DQPSK
BasebandCrystal OSC 40MHz
Hopping & channels1600 hops/sec, 1 MHz channel space, 79 Channels (BT 5.0 to 2 MHz channel space)
RF Input Impedance50 ohms
AntennaIntegrated chip antenna
InterfaceData: UART (Standard), I2C; Others: PIO, AIO, PWM.USB
ProfileSPP, HID, GATT
Advanced FeatureMFi, OTA
Temperature-20ºC to +70 ºC
Humidity10% ~ 95% Non-Condensing
EnvironmentalRoHS Compliant
+

Linux driver & firmware

Linux-bluetooth sub-system

+

Realtek bluetooth firmware

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# cat PKGBUILD
# Maintainer: Jack Chen <redchenjs@live.com>

pkgname=rtl8761b-fw
pkgver=20200610
pkgrel=1
pkgdesc="Realtek bluetooth firmware for RTL8761B based devices"
arch=('any')
url="https://www.xmpow.com/pages/download"
license=('unknown')
source=(
"https://mpow.s3-us-west-1.amazonaws.com/mpow_MPBH456AB_driver+for+Linux.tgz"
)
sha512sums=(
'ebdf480a2e7746853b2ad1f422befcc86ec39c676147350b5440000e6e3c1e4cad3c4154c8fbdc72de86103269c336fc196b1173703767640a15d55d297928a2'
)

package() {
cd "$srcdir/20200610_LINUX_BT_DRIVER/rtkbt-firmware/lib/firmware/rtlbt"

install -Dm644 rtl8761b_fw "$pkgdir/usr/lib/firmware/rtl_bt/rtl8761b_fw.bin"
install -Dm644 rtl8761b_config "$pkgdir/usr/lib/firmware/rtl_bt/rtl8761b_config.bin"
}
+ +
1
2
3
# find /lib/firmware | grep rtl8761b | xargs ls -ln
-rw-r--r-- 1 0 0 25 Oct 20 23:00 /lib/firmware/rtl_bt/rtl8761b_config.bin
-rw-r--r-- 1 0 0 35644 Oct 20 23:00 /lib/firmware/rtl_bt/rtl8761b_fw.bin
+ +
1
2
3
# find /lib/firmware | grep rtl8761b | xargs sha256sum
6ddeb15f23588053e00cb08d25588bd7cf98d60fa93d9478efcef4ae8064a7ac /lib/firmware/rtl_bt/rtl8761b_config.bin
65e638f295e892ba0341ea825d48b6d392c28169098565affb77f06ba1597dce /lib/firmware/rtl_bt/rtl8761b_fw.bin
+ +

dmesg

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# dmesg -w

[ 3466.994606] usb 2-1: new full-speed USB device number 6 using xhci_hcd
[ 3467.143775] usb 2-1: New USB device found, idVendor=0bda, idProduct=8771, bcdDevice= 2.00
[ 3467.143780] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 3467.143783] usb 2-1: Product: Bluetooth Radio
[ 3467.143785] usb 2-1: Manufacturer: Realtek
[ 3467.143787] usb 2-1: SerialNumber: 00E04C239987
[ 3467.146180] Bluetooth: hci0: RTL: examining hci_ver=0a hci_rev=000b lmp_ver=0a lmp_subver=8761
[ 3467.147148] Bluetooth: hci0: RTL: rom_version status=0 version=1
[ 3467.147152] Bluetooth: hci0: RTL: loading rtl_bt/rtl8761b_fw.bin
[ 3467.147246] Bluetooth: hci0: RTL: loading rtl_bt/rtl8761b_config.bin
[ 3467.147307] Bluetooth: hci0: RTL: cfg_sz 25, total sz 21389
[ 3467.260167] Bluetooth: hci0: RTL: fw version 0x0d99646b
[ 3531.453265] Bluetooth: hci0: Ignoring error of Inquiry Cancel command
[ 3545.075429] input: Redmi K30 Pro (AVRCP) as /devices/virtual/input/input19
+ +

bluetoothctl

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# bluetoothctl version
Version 5.53

# bluetoothctl list
Controller 8C:88:2B:30:4B:09 E7440-01 [default]

# bluetoothctl show
Controller 8C:88:2B:30:4B:09 (public)
Name: E7440-01
Alias: E7440-01
Class: 0x001c010c
Powered: yes
Discoverable: yes
DiscoverableTimeout: 0x00000000
Pairable: yes
UUID: Message Notification Se.. (00001133-0000-1000-8000-00805f9b34fb)
UUID: A/V Remote Control (0000110e-0000-1000-8000-00805f9b34fb)
UUID: OBEX Object Push (00001105-0000-1000-8000-00805f9b34fb)
UUID: Message Access Server (00001132-0000-1000-8000-00805f9b34fb)
UUID: IrMC Sync (00001104-0000-1000-8000-00805f9b34fb)
UUID: PnP Information (00001200-0000-1000-8000-00805f9b34fb)
UUID: Vendor specific (00005005-0000-1000-8000-0002ee000001)
UUID: Headset AG (00001112-0000-1000-8000-00805f9b34fb)
UUID: Headset (00001108-0000-1000-8000-00805f9b34fb)
UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
UUID: Phonebook Access Server (0000112f-0000-1000-8000-00805f9b34fb)
UUID: Audio Sink (0000110b-0000-1000-8000-00805f9b34fb)
UUID: Generic Access Profile (00001800-0000-1000-8000-00805f9b34fb)
UUID: Audio Source (0000110a-0000-1000-8000-00805f9b34fb)
UUID: OBEX File Transfer (00001106-0000-1000-8000-00805f9b34fb)
Modalias: usb:v1D6Bp0246d0535
Discovering: yes
Advertising Features:
ActiveInstances: 0x00
SupportedInstances: 0x05
SupportedIncludes: tx-power
SupportedIncludes: appearance
SupportedIncludes: local-name
SupportedSecondaryChannels: 1M
SupportedSecondaryChannels: 2M
SupportedSecondaryChannels: Coded

# bluetoothctl devices
Device 6C:7F:E4:9C:57:4E 6C-7F-E4-9C-57-4E
Device E0:B6:55:60:54:2D MI BT18 BLE
Device AC:C1:EE:0C:77:AB 小米手机5
Device 9C:28:F7:97:DF:48 Redmi K30 Pro

# bluetoothctl info 9C:28:F7:97:DF:48
Device 9C:28:F7:97:DF:48 (public)
Name: Redmi K30 Pro
Alias: Redmi K30 Pro
Class: 0x005a020c
Icon: phone
Paired: yes
Trusted: yes
Blocked: no
Connected: yes
LegacyPairing: no
UUID: OBEX Object Push (00001105-0000-1000-8000-00805f9b34fb)
UUID: Headset (00001108-0000-1000-8000-00805f9b34fb)
UUID: Audio Source (0000110a-0000-1000-8000-00805f9b34fb)
UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
UUID: Headset AG (00001112-0000-1000-8000-00805f9b34fb)
UUID: PANU (00001115-0000-1000-8000-00805f9b34fb)
UUID: NAP (00001116-0000-1000-8000-00805f9b34fb)
UUID: Handsfree Audio Gateway (0000111f-0000-1000-8000-00805f9b34fb)
UUID: Phonebook Access Server (0000112f-0000-1000-8000-00805f9b34fb)
UUID: Message Access Server (00001132-0000-1000-8000-00805f9b34fb)
UUID: PnP Information (00001200-0000-1000-8000-00805f9b34fb)
UUID: Generic Access Profile (00001800-0000-1000-8000-00805f9b34fb)
UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
UUID: Unknown (00009955-0000-1000-8000-00805f9b34fb)
Modalias: bluetooth:v038Fp1200d1436
RSSI: -76
+ +

hciconfig

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# hciconfig -a
hci0: Type: Primary Bus: USB
BD Address: 8C:88:2B:30:4B:09 ACL MTU: 1021:5 SCO MTU: 255:11
UP RUNNING PSCAN ISCAN INQUIRY
RX bytes:45254864 acl:73336 sco:0 events:1907 errors:0
TX bytes:32585 acl:140 sco:0 commands:691 errors:0
Features: 0xff 0xff 0xff 0xfe 0xdb 0xfd 0x7b 0x87
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
Link policy: RSWITCH HOLD SNIFF PARK
Link mode: SLAVE ACCEPT
Name: 'E7440-01'
Class: 0x1c010c
Service Classes: Rendering, Capturing, Object Transfer
Device Class: Computer, Laptop
HCI Version: 5.1 (0xa) Revision: 0xd99
LMP Version: 5.1 (0xa) Subversion: 0x646b
Manufacturer: Realtek Semiconductor Corporation (93)
+ +
1
2
3
4
5
6
# hciconfig hci0 version
hci0: Type: Primary Bus: USB
BD Address: 8C:88:2B:30:4B:09 ACL MTU: 1021:5 SCO MTU: 255:11
HCI Version: 5.1 (0xa) Revision: 0xd99
LMP Version: 5.1 (0xa) Subversion: 0x646b
Manufacturer: Realtek Semiconductor Corporation (93)
+ +
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# hciconfig hci0 features
hci0: Type: Primary Bus: USB
BD Address: 8C:88:2B:30:4B:09 ACL MTU: 1021:5 SCO MTU: 255:11
Features page 0: 0xff 0xff 0xff 0xfe 0xdb 0xfd 0x7b 0x87
<3-slot packets> <5-slot packets> <encryption> <slot offset>
<timing accuracy> <role switch> <hold mode> <sniff mode>
<park state> <RSSI> <channel quality> <SCO link> <HV2 packets>
<HV3 packets> <u-law log> <A-law log> <CVSD> <paging scheme>
<power control> <transparent SCO> <broadcast encrypt>
<EDR ACL 2 Mbps> <EDR ACL 3 Mbps> <enhanced iscan>
<interlaced iscan> <interlaced pscan> <inquiry with RSSI>
<extended SCO> <EV4 packets> <EV5 packets> <AFH cap. slave>
<AFH class. slave> <LE support> <3-slot EDR ACL>
<5-slot EDR ACL> <pause encryption> <AFH cap. master>
<AFH class. master> <EDR eSCO 2 Mbps> <EDR eSCO 3 Mbps>
<3-slot EDR eSCO> <extended inquiry> <LE and BR/EDR>
<simple pairing> <encapsulated PDU> <err. data report>
<non-flush flag> <LSTO> <inquiry TX power> <EPC>
<extended features>
Features page 1: 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00
Features page 2: 0x5f 0x02 0x00 0x00 0x00 0x00 0x00 0x00
+ +

hwinfo

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# hwinfo --bluetooth
02: USB 00.0: 11500 Bluetooth Device
[Created at usb.122]
Unique ID: FKGF.huCbZCwfOy3
Parent ID: pBe4.2DFUsyrieMD
SysFS ID: /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.0
SysFS BusID: 2-1:1.0
Hardware Class: bluetooth
Model: "Realtek Bluetooth Radio"
Hotplug: USB
Vendor: usb 0x0bda "Realtek Semiconductor Corp."
Device: usb 0x8771 "Bluetooth Radio"
Revision: "2.00"
Serial ID: "00E04C239987"
Driver: "btusb"
Driver Modules: "btusb"
Speed: 12 Mbps
Module Alias: "usb:v0BDAp8771d0200dcE0dsc01dp01icE0isc01ip01in00"
Driver Info #0:
Driver Status: btusb is active
Driver Activation Cmd: "modprobe btusb"
Config Status: cfg=new, avail=yes, need=no, active=unknown
Attached to: #8 (Hub)
+ +

lsusb

1
2
3
4
5
6
7
# lsusb
Bus 001 Device 002: ID 8087:8000 Intel Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 002 Device 002: ID 0c45:64d2 Microdia Integrated Webcam
Bus 002 Device 006: ID 0bda:8771 Realtek Semiconductor Corp. Bluetooth Radio
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
+ +

usb-devices

1
2
3
4
5
6
7
8
9
10
# usb-devices | awk '/0bda/' RS=
T: Bus=02 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 6 Spd=12 MxCh= 0
D: Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=0bda ProdID=8771 Rev=02.00
S: Manufacturer=Realtek
S: Product=Bluetooth Radio
S: SerialNumber=00E04C239987
C: #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=500mA
I: If#=0x0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
I: If#=0x1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
+ +

lsusb verbose

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
# lsusb -v -d 0bda:8771

Bus 002 Device 006: ID 0bda:8771 Realtek Semiconductor Corp. Bluetooth Radio
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 224 Wireless
bDeviceSubClass 1 Radio Frequency
bDeviceProtocol 1 Bluetooth
bMaxPacketSize0 64
idVendor 0x0bda Realtek Semiconductor Corp.
idProduct 0x8771
bcdDevice 2.00
iManufacturer 1 Realtek
iProduct 2 Bluetooth Radio
iSerial 3 00E04C239987
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 0x00b1
bNumInterfaces 2
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xe0
Self Powered
Remote Wakeup
MaxPower 500mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 3
bInterfaceClass 224 Wireless
bInterfaceSubClass 1 Radio Frequency
bInterfaceProtocol 1 Bluetooth
iInterface 4 Bluetooth Radio
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0010 1x 16 bytes
bInterval 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82 EP 2 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 224 Wireless
bInterfaceSubClass 1 Radio Frequency
bInterfaceProtocol 1 Bluetooth
iInterface 4 Bluetooth Radio
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x03 EP 3 OUT
bmAttributes 1
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize 0x0000 1x 0 bytes
bInterval 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83 EP 3 IN
bmAttributes 1
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize 0x0000 1x 0 bytes
bInterval 1
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 1
bNumEndpoints 2
bInterfaceClass 224 Wireless
bInterfaceSubClass 1 Radio Frequency
bInterfaceProtocol 1 Bluetooth
iInterface 4 Bluetooth Radio
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x03 EP 3 OUT
bmAttributes 1
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize 0x0009 1x 9 bytes
bInterval 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83 EP 3 IN
bmAttributes 1
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize 0x0009 1x 9 bytes
bInterval 1
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 2
bNumEndpoints 2
bInterfaceClass 224 Wireless
bInterfaceSubClass 1 Radio Frequency
bInterfaceProtocol 1 Bluetooth
iInterface 4 Bluetooth Radio
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x03 EP 3 OUT
bmAttributes 1
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize 0x0011 1x 17 bytes
bInterval 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83 EP 3 IN
bmAttributes 1
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize 0x0011 1x 17 bytes
bInterval 1
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 3
bNumEndpoints 2
bInterfaceClass 224 Wireless
bInterfaceSubClass 1 Radio Frequency
bInterfaceProtocol 1 Bluetooth
iInterface 4 Bluetooth Radio
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x03 EP 3 OUT
bmAttributes 1
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize 0x0019 1x 25 bytes
bInterval 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83 EP 3 IN
bmAttributes 1
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize 0x0019 1x 25 bytes
bInterval 1
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 4
bNumEndpoints 2
bInterfaceClass 224 Wireless
bInterfaceSubClass 1 Radio Frequency
bInterfaceProtocol 1 Bluetooth
iInterface 4 Bluetooth Radio
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x03 EP 3 OUT
bmAttributes 1
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize 0x0021 1x 33 bytes
bInterval 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83 EP 3 IN
bmAttributes 1
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize 0x0021 1x 33 bytes
bInterval 1
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 5
bNumEndpoints 2
bInterfaceClass 224 Wireless
bInterfaceSubClass 1 Radio Frequency
bInterfaceProtocol 1 Bluetooth
iInterface 4 Bluetooth Radio
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x03 EP 3 OUT
bmAttributes 1
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize 0x0031 1x 49 bytes
bInterval 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83 EP 3 IN
bmAttributes 1
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize 0x0031 1x 49 bytes
bInterval 1
can't get debug descriptor: Resource temporarily unavailable
Device Status: 0x0001
Self Powered
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/11/21/freebsd-12-on-raspberry-pi-zero/index.html b/2020/11/21/freebsd-12-on-raspberry-pi-zero/index.html new file mode 100644 index 00000000..e5f89d58 --- /dev/null +++ b/2020/11/21/freebsd-12-on-raspberry-pi-zero/index.html @@ -0,0 +1,224 @@ + + + + + + + + + + + + FreeBSD 12 on Raspberry Pi Zero | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ FreeBSD 12 on Raspberry Pi Zero +

+ +

FreeBSD 12 on Raspberry Pi Zero

Download FreeBSD image

+
1
2
3
4
5
$ aria2c https://download.freebsd.org/ftp/releases/ISO-IMAGES/12.2/FreeBSD-12.2-RELEASE-arm-armv6-RPI-B.img.xz

FREEBSD_STABLE_ROOT=https://download.freebsd.org/ftp/snapshots/arm/armv6/ISO-IMAGES/12.2
FREEBSD_STABLE_FILE=`curl -sS ${FREEBSD_STABLE_ROOT}/ | grep -oP "(FreeBSD-.*?-STABLE-arm-armv6-RPI-B-.*?xz)" | tail -1`
aria2c ${FREEBSD_STABLE_ROOT}/${FREEBSD_STABLE_FILE}
+ +

Write image to SDXC card

1
$ cat FreeBSD-12.2-STABLE-arm-armv6-RPI-B-20201119-r367792.img.xz | xz -cd | sudo dd of=/dev/sdb bs=4M oflag=sync status=progress; time sync
+ +

Booting Raspberry Pi

1
$ sudo minicom -b 115200 -8 -D /dev/ttyUSB0
+ +
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
U-Boot 2020.10 (Nov 21 2020 - 14:02:49 +0000)

DRAM: 448 MiB
RPI Zero (0x900093)
MMC: mmc@7e300000: 1
Loading Environment from FAT... In: serial
Out: vidconsole
Err: vidconsole
Net: No ethernet found.
starting USB...
Bus usb@7e980000: USB DWC2
scanning bus usb@7e980000 for devices...
USB device not accepting new address (error=0)
2 USB Device(s) found
scanning usb for storage devices... 0 Storage Device(s) found
Hit any key to stop autoboot: 0
MMC Device 0 not found
no mmc device at slot 0
switch to partitions #0, OK
mmc1 is current device
Scanning mmc 1:1...
Found EFI removable media binary efi/boot/bootarm.efi
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
Scanning disk mmc@7e300000.blk...
** Unrecognized filesystem type **
Found 3 disks
No EFI system partition
BootOrder not defined
EFI boot manager: Cannot load any image
625488 bytes read in 76 ms (7.8 MiB/s)
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
Booting /efi\boot\bootarm.efi
Consoles: EFI console
Reading loader env vars from /efi/freebsd/loader.env
Setting currdev to disk0p1:
FreeBSD/arm EFI loader, Revision 1.1

Command line arguments: l
EFI version: 2.80
EFI Firmware: Das U-Boot (rev 8224.4096)
Console: efi (0)
Load Path: /efi\boot\bootarm.efi
Load Device: /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(1)/SD(0)/HD(1,0x01,0,0x42f,0x18fa8)
Trying ESP: /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(1)/SD(0)/HD(1,0x01,0,0x42f,0x18fa8)
Setting currdev to disk0p1:
Trying: /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(1)/SD(0)/HD(2,0x01,0,0x193d7,0x1d88c29)
Setting currdev to disk0p2:
Loading /boot/defaults/loader.conf
Loading /boot/defaults/loader.conf
Loading /boot/device.hints
Loading /boot/loader.conf
Loading /boot/loader.conf.local
Loading kernel...
/boot/kernel/kernel text=0x6f1708 data=0x83710 data=0x0+0x1f0000 syms=[0x4+0xc37f0+0x4+0xcd395]
Loading configured modules...
/etc/hostid size=0x25
/boot/entropy size=0x1000
/boot/kernel/umodem.ko text=0x1540 text=0xf40 data=0x234+0x4 syms=[0x4+0xe70+0x4+0xa74]
loading required module 'ucom'
/boot/kernel/ucom.ko text=0x1714 text=0x2d3c data=0x3c4+0x838 syms=[0x4+0x13e0+0x4+0xbac]

Hit [Enter] to boot immediately, or any other key for command prompt.
Booting [/boot/kernel/kernel]...
Using DTB provided by EFI at 0x7ef6000.
Kernel entry at 0x14c00180...
Kernel args: (null)
---<<BOOT>>---
Copyright (c) 1992-2020 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 12.2-STABLE r367792 RPI-B arm
FreeBSD clang version 10.0.1 (git@github.com:llvm/llvm-project.git llvmorg-10.0.1-0-gef32c611aa2)
VT: init without driver.
CPU: ARM ARM1176 r0p7 (ECO: 0x00000000)
CPU Features:
Thumb, Security, VMSAv7
Optional instructions:
UMULL, SMULL, MLA, SIMD(ext)
16KB/32B 4-way instruction cache
16KB/32B 4-way WB data cache
real memory = 469757952 (447 MB)
avail memory = 446181376 (425 MB)
random: unblocking device.
random: entropy device external interface
kbd0 at kbdmux0
ofwbus0: <Open Firmware Device Tree>
simplebus0: <Flattened device tree simple bus> on ofwbus0
intc0: <BCM2835 Interrupt Controller> mem 0x7e00b200-0x7e00b3ff on simplebus0
gpio0: <BCM2708/2835 GPIO controller> mem 0x7e200000-0x7e2000b3 irq 19,20 on simplebus0
gpiobus0: <OFW GPIO bus> on gpio0
bcm_dma0: <BCM2835 DMA Controller> mem 0x7e007000-0x7e007eff irq 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16 on simplebus0
bcmwd0: <BCM2708/2835 Watchdog> mem 0x7e100000-0x7e100113,0x7e00a000-0x7e00a023 on simplebus0
bcmrng0: <Broadcom BCM2835 RNG> mem 0x7e104000-0x7e10400f irq 17 on simplebus0
mbox0: <BCM2835 VideoCore Mailbox> mem 0x7e00b880-0x7e00b8bf irq 18 on simplebus0
gpioc0: <GPIO controller> on gpio0
uart0: <PrimeCell UART (PL011)> mem 0x7e201000-0x7e2011ff irq 21 on simplebus0
uart0: console (115200,n,8,1)
bcm283x_dwcotg0: <DWC OTG 2.0 integrated USB controller (bcm283x)> mem 0x7e980000-0x7e98ffff,0x7e006000-0x7e006fff irq 41,42 on simplebus0
usbus0 on bcm283x_dwcotg0
systimer0 mem 0x7e003000-0x7e003fff irq 43,44,45,46 on simplebus0
Event timer "BCM2835-3" frequency 1000000 Hz quality 1000
Timecounter "BCM2835-3" frequency 1000000 Hz quality 1000
sdhci_bcm0: <Broadcom 2708 SDHCI controller> mem 0x7e300000-0x7e3000ff irq 48 on simplebus0
mmc0: <MMC/SD bus> on sdhci_bcm0
vchiq0: <BCM2835 VCHIQ> mem 0x7e00b840-0x7e00b87b irq 52 on simplebus0
vchiq: local ver 8 (min 3), remote ver 8.
pcm0: <VCHIQ audio> on vchiq0
fb0: <BCM2835 VT framebuffer driver> on simplebus0
fb0: keeping existing fb bpp of 32
fbd0 on fb0
VT: initialize with new VT driver "fb".
fb0: 656x416(656x416@0,0) 32bpp
fb0: fbswap: 1, pitch 2624, base 0x1eaf0000, screen_size 1091584
gpioled0: <GPIO LEDs> on ofwbus0
cryptosoft0: <software crypto>
Timecounters tick every 1.000 msec
usbus0: 480Mbps High Speed USB v2.0
ugen0.1: <DWCOTG OTG Root HUB> at usbus0
uhub0: <DWCOTG OTG Root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus0
mmcsd0: 16GB <SDHC NCard 1.0 SN 229045F3 MFG 02/2012 by 115 BG> at mmc0 50.0MHz/4bit/65535-block
Trying to mount root from ufs:/dev/ufs/rootfs [rw]...
WARNING: was not properly dismounted
Warning: no time-of-day clock registered, system time will not be set accurately
uhub0: 1 port with 1 removable, self powered
ugen0.2: <vendor 0x214b USB2.0 HUB> at usbus0
uhub1 on uhub0
uhub1: <vendor 0x214b USB2.0 HUB, class 9/0, rev 2.00/1.00, addr 2> on usbus0
Setting hostuuid: 617d555b-2a1c-11eb-ad9d-75bde1a855ce.
Setting hostid: 0xdaae4663.
Starting file system checks:
uhub1: 4 ports with 4 removable, self powered
/dev/ufs/rootfs: 24059 files, 503425 used, 3241854 free (214 frags, 405205 blocks, 0.0% fragmentation)
Mounting local filesystems:.
ELF ldconfig path: /lib /usr/lib /usr/lib/compat
Soft Float compatibility ldconfig path:
Setting hostname: rpi-b.
Setting up harvesting: [UMA],[FS_ATIME],SWI,INTERRUPT,NET_NG,NET_ETHER,NET_TUN,MOUSE,KEYBOARD,ATTACH,CACHED
Feeding entropy: .
lo0: link state changed to UP
Starting Network: lo0.
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
inet 127.0.0.1 netmask 0xff000000
groups: lo
nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
ugen0.3: <Unknown > at usbus0 (disconnected)
Starting devd.
add host 127.0.0.1: gateway lo0 fib 0: route already in table
add host ::1: gateway lo0 fib 0: route already in table
add net fe80::: gateway ::1
add net ff02::: gateway ::1
add net ::ffff:0.0.0.0: gateway ::1
add net ::0.0.0.0: gateway ::1
Creating and/or trimming log files.
Updating motd:.
Updating /var/run/os-release done.
Starting syslogd.
Clearing /tmp (X related).
Mounting late filesystems:.
Performing sanity check on sshd configuration.
Starting sshd.
Configuring vt: blanktime.
Starting cron.
Starting background file system checks in 60 seconds.

Thu Nov 21 14:24:18 UTC 2020

FreeBSD/arm (rpi-b) (ttyu0)

login:
Password:
+ +

Logging in to FreeBSD

The default passwords for the images are freebsd/freebsd and root/root .

+

If you logging remotely, freebsd/freebsd is mandatory, since root remote login is disabled by default.

+

cat /etc/os-release

1
2
3
4
5
6
7
8
9
10
11
12
13
root@rpi-b:~ # ls -l /etc/os-release
lrwxr-xr-x 1 root wheel 21 Nov 19 04:03 /etc/os-release -> ../var/run/os-release

root@rpi-b:~ # cat /etc/os-release
NAME=FreeBSD
VERSION=12.2-STABLE
VERSION_ID=12.2
ID=freebsd
ANSI_COLOR="0;31"
PRETTY_NAME="FreeBSD 12.2-STABLE"
CPE_NAME=cpe:/o:freebsd:freebsd:12.2
HOME_URL=https://FreeBSD.org/
BUG_REPORT_URL=https://bugs.FreeBSD.org/
+ +

List of processes after startup

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
root@rpi-b:~ # ps ax
PID TT STAT TIME COMMAND
0 - DLs 0:00.01 [kernel]
1 - ILs 0:00.06 /sbin/init --
2 - DL 0:00.00 [crypto]
3 - DL 0:00.00 [crypto returns 0]
4 - DL 0:00.00 [cam]
5 - IL 0:00.00 [VCHIQ-0]
6 - IL 0:00.00 [VCHIQr-0]
7 - IL 0:00.00 [VCHIQs-0]
8 - DL 0:00.00 [sctp_iterator]
9 - DL 0:00.78 [rand_harvestq]
10 - RNL 30:45.95 [idle]
11 - WL 0:10.31 [intr]
12 - DL 0:00.53 [geom]
13 - DL 0:00.00 [sequencer 00]
14 - DL 0:00.27 [usb]
15 - DL 0:00.00 [soaiod1]
16 - DL 0:00.00 [soaiod2]
17 - DL 0:00.00 [soaiod3]
18 - DL 0:00.00 [soaiod4]
19 - DL 0:00.47 [mmcsd0: mmc/sd card]
20 - IL 0:00.00 [VCHIQka-0]
21 - IL 0:00.00 [bcm2835_audio_worke]
22 - DL 0:00.59 [pagedaemon]
23 - DL 0:00.00 [vmdaemon]
24 - DL 0:00.51 [bufdaemon]
25 - DL 0:00.04 [vnlru]
26 - DL 0:00.16 [syncer]
27 - DL 0:00.29 [schedcpu]
555 - Ss 0:00.00 /sbin/devd
728 - Is 0:00.06 /usr/sbin/syslogd -s
819 - Is 0:00.01 /usr/sbin/sshd
828 - Ss 0:00.08 /usr/sbin/cron -s
852 u0 Is 0:00.21 login [pam] (login)
853 u0 S 0:00.58 -csh (csh)
937 u0 R+ 0:00.02 ps ax
844 v0 Is+ 0:00.03 /usr/libexec/getty Pc ttyv0
845 v1 Is+ 0:00.03 /usr/libexec/getty Pc ttyv1
846 v2 Is+ 0:00.03 /usr/libexec/getty Pc ttyv2
847 v3 Is+ 0:00.03 /usr/libexec/getty Pc ttyv3
848 v4 Is+ 0:00.03 /usr/libexec/getty Pc ttyv4
849 v5 Is+ 0:00.03 /usr/libexec/getty Pc ttyv5
850 v6 Is+ 0:00.03 /usr/libexec/getty Pc ttyv6
851 v7 Is+ 0:00.03 /usr/libexec/getty Pc ttyv7
root@rpi-b:~ #
+ +

Conclusion

FreeBSD 12.2 can’t found Realtek RTL8152 Based USB Ethernet Adapter, it’s really disappointing. FreeBSD 13.0 snapshot have boot errors, it’s even more disappointing.

+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/11/22/netbsd-9-on-raspberry-pi-zero/index.html b/2020/11/22/netbsd-9-on-raspberry-pi-zero/index.html new file mode 100644 index 00000000..82890ad3 --- /dev/null +++ b/2020/11/22/netbsd-9-on-raspberry-pi-zero/index.html @@ -0,0 +1,269 @@ + + + + + + + + + + + + NetBSD 9 on Raspberry Pi Zero | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ NetBSD 9 on Raspberry Pi Zero +

+ +

NetBSD 9 on Raspberry Pi Zero

Download NetBSD image

+
1
2
3
$ aria2c https://cdn.netbsd.org/pub/NetBSD/NetBSD-9.1/evbarm-earmv6hf/binary/gzimg/rpi.img.gz

$ aria2c https://nycdn.netbsd.org/pub/NetBSD-daily/netbsd-9/latest/evbarm-earmv6hf/binary/gzimg/rpi.img.gz
+ +

Write image to SDXC card

1
$ cat rpi.img.gz | gzip -cd | sudo dd of=/dev/sdb bs=4M oflag=sync status=progress; time sync
+ +

Booting Raspberry Pi

1
$ sudo minicom -b 115200 -8 -D /dev/ttyUSB0
+ +
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
[     1.000000] Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
[ 1.000000] 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
[ 1.000000] 2018, 2019, 2020 The NetBSD Foundation, Inc. All rights reserved.
[ 1.000000] Copyright (c) 1982, 1986, 1989, 1991, 1993
[ 1.000000] The Regents of the University of California. All rights reserved.

[ 1.000000] NetBSD 9.1 (RPI) #0: Sun Oct 18 19:24:30 UTC 2020
[ 1.000000] mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/evbarm/compile/RPI
[ 1.000000] total memory = 448 MB
[ 1.000000] avail memory = 434 MB
[ 1.000000] timecounter: Timecounters tick every 10.000 msec
[ 1.000000] running cgd selftest aes-xts-256 aes-xts-512 done
[ 1.000000] armfdt0 (root)
[ 1.000000] simplebus0 at armfdt0: Raspberry Pi Zero Rev 1.3
[ 1.000000] simplebus1 at simplebus0
[ 1.000000] simplebus2 at simplebus0
[ 1.000000] simplebus3 at simplebus0
[ 1.000000] cpus0 at simplebus0
[ 1.000000] cpu0 at cpus0: 700 MHz ARM1176JZ-S r0p7 (ARM11J V6ZK core)
[ 1.000000] cpu0: DC enabled IC enabled WB enabled LABT
[ 1.000000] cpu0: 16KB/32B 4-way L1 VIPT Instruction cache
[ 1.000000] cpu0: 16KB/32B 4-way write-back-locking-C L1 VIPT Data cache
[ 1.000000] vfp0 at cpu0: VFP11, rounding, exceptions
[ 1.000000] fclock0 at simplebus2: 19200000 Hz fixed clock (osc)
[ 1.000000] fclock1 at simplebus2: 480000000 Hz fixed clock (otg)
[ 1.000000] simplebus4 at simplebus1
[ 1.000000] bcmicu0 at simplebus1
[ 1.000000] bcmcprman0 at simplebus1: BCM283x Clock Controller
[ 1.000000] bcmtmr0 at simplebus1: VC System Timer
[ 1.000000] bcmtmr0: interrupting on icu irq 3
[ 1.000000] bcmaux0 at simplebus1
[ 1.000000] /soc/thermal@7e212000 at simplebus1 not configured
[ 1.000000] /soc/dsi@7e209000 at simplebus1 not configured
[ 1.000000] bcmgpio0 at simplebus1: GPIO controller
[ 1.000000] bcmgpio0: pins 0..31 interrupting on icu irq 49
[ 1.000000] bcmgpio0: pins 32..54 interrupting on icu irq 50
[ 1.000000] gpio0 at bcmgpio0: 54 pins
[ 1.000000] bcmdmac0 at simplebus1: DMA0 DMA2 DMA4 DMA5 DMA8 DMA9 DMA10
[ 1.000000] /soc/power at simplebus1 not configured
[ 1.000000] bsciic0 at simplebus1: Broadcom Serial Controller
[ 1.000000] iic0 at bsciic0: I2C bus
[ 1.000000] /phy at simplebus0 not configured
[ 1.000000] bcmpmwdog0 at simplebus1: Power management, Reset and Watchdog controller
[ 1.000000] bcmmbox0 at simplebus1: VC mailbox
[ 1.000000] bcmmbox0: interrupting on icu irq 65
[ 1.000000] vcmbox0 at bcmmbox0
[ 1.000000] plcom0 at simplebus1: ARM PL011 UART
[ 1.000000] plcom0: txfifo disabled
[ 1.000000] plcom0: console
[ 1.000000] plcom0: interrupting on icu irq 57
[ 1.000000] bcmsdhost0 at simplebus1: SD HOST controller
[ 1.000000] bcmsdhost0: interrupting on icu irq 56
[ 1.000000] bsciic1 at simplebus1: Broadcom Serial Controller
[ 1.000000] iic1 at bsciic1: I2C bus
[ 1.000000] bsciic2 at simplebus1: Broadcom Serial Controller
[ 1.000000] iic2 at bsciic2: I2C bus
[ 1.000000] /soc/vec@7e806000 at simplebus1 not configured
[ 1.000000] /soc/hdmi@7e902000 at simplebus1 not configured
[ 1.000000] dwctwo0 at simplebus1: USB controller
[ 1.000000] dwctwo0: interrupting on icu irq 9
[ 1.000000] /soc/gpu at simplebus1 not configured
[ 1.000000] genfb0 at simplebus1: switching to framebuffer console
[ 1.000000] genfb0: framebuffer at 0x5e876000, size 1280x720, depth 32, stride 5120
[ 1.000000] wsdisplay0 at genfb0 kbdmux 1: console (default, vt100 emulation)
[ 1.000000] wsmux1: connecting to wsdisplay0
[ 1.000000] wsdisplay0: screen 1-3 added (default, vt100 emulation)
[ 1.000000] vchiq0 at simplebus1: BCM2835 VCHIQ
[ 1.000000] /arm-pmu at simplebus0 not configured
[ 1.000000] gpioleds0 at simplebus0: ACT
[ 1.000000] /soc/txp@7e004000 at simplebus1 not configured
[ 1.000000] bcmrng0 at simplebus1: RNG
[ 1.000000] timecounter: Timecounter "clockinterrupt" frequency 100 Hz quality 0
[ 1.000003] timecounter: Timecounter "bcmtmr0" frequency 1000000 Hz quality 100
[ 1.050020] sdmmc0 at bcmsdhost0
[ 1.050020] dwctwo0: Core Release: 2.80a (snpsid=4f54280a)
[ 1.050020] usb0 at dwctwo0: USB revision 2.0
[ 1.110148] uhub0 at usb0: NetBSD (0000) DWC2 root hub (0000), class 9/0, rev 2.00/1.00, addr 1
[ 1.110148] uhub0: 1 port with 1 removable, self powered
[ 1.120174] IPsec: Initialized Security Association Processing.
[ 1.150235] sdmmc0: direct I/O error 5, r=6 p=0x9bd91f2c write
[ 1.160249] sdmmc0: SD card status: 4-bit, C10, U1, V10, A1
[ 1.160249] ld0 at sdmmc0: <0x27:0x5048:SD64G:0x60:0xda7f8e63:0x14a>
[ 1.160249] ld0: 59616 MB, 7599 cyl, 255 head, 63 sec, 512 bytes/sect x 122093568 sectors
[ 1.160249] ld0: 4-bit width, High-Speed/SDR25, 50.000 MHz
[ 2.941461] uhub1 at uhub0 port 1: vendor 214b (0x214b) USB2.0 HUB (0x7250), class 9/0, rev 2.00/1.00, addr 2
[ 2.941461] uhub1: single transaction translator
[ 2.941461] uhub1: 4 ports with 4 removable, self powered
[ 4.252284] ure0 at uhub1 port 1
[ 4.252284] ure0: Realtek (0xbda) USB 10/100 LAN (0x8152), rev 2.10/20.00, addr 3
[ 4.252284] ure0: RTL8152 ver 4c10
[ 4.312354] rlphy0 at ure0 phy 0: RTL8201E 10/100 media interface, rev. 2
[ 4.322369] rlphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
[ 4.332562] ure0: Ethernet address 00:e0:4c:36:03:b4
[ 4.332562] uhub0: autoconfiguration error: illegal enable change, port 1
[ 4.332562] WARNING: 1 error while detecting hardware; check system log.
[ 4.332562] boot device: ld0
[ 4.332562] root on ld0a dumps on ld0b
[ 4.342577] root file system type: ffs
[ 4.342577] kern.module.path=/stand/evbarm/9.1/modules
[ 4.362615] vchiq0: interrupting on icu irq 66
[ 4.362615] vchiq: vchiq_init_state: slot_zero = 0xc97e0000, is_master = 0
[ 4.362615] vchiq: local ver 8 (min 3), remote ver 8.
[ 4.362615] vcaudio0 at vchiq0: auds
[ 4.362615] WARNING: no TOD clock present
[ 4.362615] WARNING: using filesystem time
[ 4.369164] WARNING: CHECK AND RESET THE DATE!
[ 4.372629] audio0 at vcaudio0: playback, capture, half duplex, independent
[ 4.372629] audio0: slinear_le:16 -> slinear_le:16 2ch 48000Hz, blk 7680 bytes (40ms) for playback
[ 4.372629] audio0: slinear_le:16 2ch 48000Hz, blk 7680 bytes (40ms) for recording
[ 4.372629] spkr0 at audio0: PC Speaker (synthesized)
[ 4.372629] wsbell at spkr0 not configured
[ 12.868235] wsdisplay0: screen 4 added (default, vt100 emulation)
+ +

Logging in to NetBSD

The default account for the images are root without password.

+

You must set the password and configure ssh to allow root login before you can log in remotely.

+
1
2
3
4
5
6
# vi /etc/ssh/sshd_config
PermitRootLogin yes
#PermitRootLogin prohibit-password

# /etc/rc.d/sshd reload
Reloading sshd config files.
+ +

System characteristics

uname

1
2
3
4
5
# uname -snrmp
NetBSD rpi 9.1 evbarm earmv6hf

# uname -ap
NetBSD rpi 9.1 NetBSD 9.1 (RPI) #0: Sun Oct 18 19:24:30 UTC 2020 mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/evbarm/compile/RPI evbarm earmv6hf
+ +

cpu

1
2
3
4
5
6
7
8
9
10
11
12
13
# dmesg | grep cpu
[ 1.000000] cpus0 at simplebus0
[ 1.000000] cpu0 at cpus0: 700 MHz ARM1176JZ-S r0p7 (ARM11J V6ZK core)
[ 1.000000] cpu0: DC enabled IC enabled WB enabled LABT
[ 1.000000] cpu0: 16KB/32B 4-way L1 VIPT Instruction cache
[ 1.000000] cpu0: 16KB/32B 4-way write-back-locking-C L1 VIPT Data cache
[ 1.000000] vfp0 at cpu0: VFP11, rounding, exceptions
[ 1.000000] cpus0 at simplebus0
[ 1.000000] cpu0 at cpus0: 700 MHz ARM1176JZ-S r0p7 (ARM11J V6ZK core)
[ 1.000000] cpu0: DC enabled IC enabled WB enabled LABT
[ 1.000000] cpu0: 16KB/32B 4-way L1 VIPT Instruction cache
[ 1.000000] cpu0: 16KB/32B 4-way write-back-locking-C L1 VIPT Data cache
[ 1.000000] vfp0 at cpu0: VFP11, rounding, exceptions
+ +

memory

1
2
3
4
5
6
7
8
9
10
11
# cat /proc/meminfo
total: used: free: shared: buffers: cached:
Mem: 456818688 108863488 347955200 0 41213952 72589312
Swap: 0 0 0
MemTotal: 446112 kB
MemFree: 339800 kB
MemShared: 0 kB
Buffers: 40248 kB
Cached: 70888 kB
SwapTotal: 0 kB
SwapFree: 0 kB
+ +

ure

Realtek RTL8152 Based USB Ethernet Adapter

+
1
2
3
4
5
6
# dmesg | grep ure0
[ 4.252284] ure0 at uhub1 port 1
[ 4.252284] ure0: Realtek (0xbda) USB 10/100 LAN (0x8152), rev 2.10/20.00, addr 3
[ 4.252284] ure0: RTL8152 ver 4c10
[ 4.312354] rlphy0 at ure0 phy 0: RTL8201E 10/100 media interface, rev. 2
[ 4.332562] ure0: Ethernet address 00:e0:4c:36:03:b4
+ +

sysctl

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
hw.disknames = ld0
hw.machine = evbarm
hw.machine_arch = earmv6hf
hw.model = raspberrypi,model-zero
hw.ncpu = 1
hw.ncpuonline = 1
hw.pagesize = 8192
hw.physmem = 469762048
hw.physmem64 = 469762048
hw.usermem = 456302592
hw.usermem64 = 456302592
kern.aio_listio_max = 512
kern.aio_max = 8192
kern.argmax = 262144
kern.clockrate: tick = 10000, tickadj = 40, hz = 100, profhz = 100, stathz = 100
kern.configname = RPI
kern.consdev = ttyE0
kern.dump_on_panic = 1
kern.expose_address = 1
kern.forkfsleep = 0
kern.fscale = 2048
kern.fsync = 1
kern.hardclock_ticks = 294254
kern.iov_max = 1024
kern.mbuf.mblowat = 16
kern.mbuf.mclbytes = 2048
kern.mbuf.mcllowat = 8
kern.mbuf.msize = 256
kern.mbuf.nmbclusters = 14336
kern.osrelease = 9.1
kern.osrevision = 901000000
kern.ostype = NetBSD
kern.timecounter.choice = bcmtmr0(q=100, f=1000000 Hz) clockinterrupt(q=0, f=100 Hz) dummy(q=-1000000, f=1000000 Hz)
kern.timecounter.hardware = bcmtmr0
kern.timecounter.timestepwarnings = 0
kern.version = NetBSD 9.1 (RPI) #0: Sun Oct 18 19:24:30 UTC 2020
machdep.board_model = 0
machdep.board_revision = 9437331
machdep.booted_device = ld0
machdep.cpu.frequency.available = 700 1000
machdep.cpu.frequency.current = 1000
machdep.cpu.frequency.max = 1000
machdep.cpu.frequency.min = 700
machdep.cpu.frequency.target = 1000
machdep.cpu_arch = 6ZK
machdep.cpu_id = 1091549031
machdep.firmware_revision = 1536600398
machdep.fpu_id = 1090592949
machdep.fpu_present = 1
machdep.simd_present = 1
machdep.simdex_present = 1
machdep.synchprim_present = 32
+ +

mmc

1
2
3
4
5
# dmesg | grep mmc
[ 1.050020] sdmmc0 at bcmsdhost0
[ 1.150235] sdmmc0: direct I/O error 5, r=6 p=0x9bd91f2c write
[ 1.160249] sdmmc0: SD card status: 4-bit, C10, U1, V10, A1
[ 1.160249] ld0 at sdmmc0: <0x27:0x5048:SD64G:0x60:0xda7f8e63:0x14a>
+ +

mounts

1
2
3
4
5
6
7
# cat /proc/mounts
/dev/ld0a / ffs rw,noatime 0 0
/dev/ld0e /boot msdos rw 0 0
kernfs /kern kernfs rw 0 0
ptyfs /dev/pts ptyfs rw 0 0
procfs /proc proc rw 0 0
tmpfs /var/shm tmpfs rw 0 0
+ +

fdisk

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# fdisk /dev/rld0
Disk: /dev/rld0
NetBSD disklabel disk geometry:
cylinders: 7599, heads: 255, sectors/track: 63 (16065 sectors/cylinder)
total sectors: 122093568, bytes/sector: 512

BIOS disk geometry:
cylinders: 1023, heads: 255, sectors/track: 63 (16065 sectors/cylinder)
total sectors: 122093568

Partitions aligned to 2048 sector boundaries, offset 63

Partition table:
0: Primary DOS with 32 bit FAT - LBA (sysid 12)
start 32768, size 163840 (80 MB, Cyls 2/10/9-12/60/48), Active
1: NetBSD (sysid 169)
start 196608, size 121896960 (59520 MB, Cyls 12/60/49-7599/248/9)
PBR is not bootable: All bytes are identical (0x00)
2: <UNUSED>
3: <UNUSED>
First active partition: 0
Drive serial number: 0 (0x00000000)
+ +

disklabel

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# disklabel /dev/ld0
# /dev/ld0:
type: SCSI
disk: STORAGE DEVICE
label: fictitious
flags: removable
bytes/sector: 512
sectors/track: 32
tracks/cylinder: 64
sectors/cylinder: 2048
cylinders: 1154
total sectors: 122093568
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0 # microseconds
track-to-track seek: 0 # microseconds
drivedata: 0

8 partitions:
# size offset fstype [fsize bsize cpg/sgs]
a: 121896960 196608 4.2BSD 0 0 0 # (Cyl. 96 - 59615)
c: 122093568 0 unused 0 0 # (Cyl. 0 - 59615)
d: 122093568 0 unused 0 0 # (Cyl. 0 - 59615)
e: 163840 32768 MSDOS # (Cyl. 16 - 95)
+ +

List of processes after startup

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# ps -axdl
UID PID PPID CPU PRI NI VSZ RSS WCHAN STAT TTY TIME COMMAND
0 0 0 0 125 0 0 8232 uvm DKl ? 0:07.74 [system]
0 1 0 18731 81 0 7496 1760 wait Is ? 0:00.05 - init
0 145 1 0 85 0 8816 1752 kqueue Is ? 0:00.01 |-- dhcpcd: [master] [ip4] [ip6]
0 196 1 0 85 0 12080 2680 kqueue Ss ? 0:00.18 |-- /usr/sbin/syslogd -s
0 370 1 7829 84 0 7952 1080 devmon Is ? 0:00.00 |-- /sbin/devpubd
0 403 1 0 85 0 11000 13152 pause Ss ? 0:00.36 |-- /usr/sbin/ntpd -p /var/run/ntpd.pid -g
0 389 403 0 85 0 11200 2880 netio I ? 0:00.12 | `-- ntpd: asynchronous dns resolver
0 474 1 21896 80 0 16504 3272 select Is ? 0:00.02 |-- /usr/sbin/sshd
0 629 1 17225 81 0 5816 1712 kqueue Is ? 0:00.01 |-- /usr/sbin/inetd -l
0 752 1 0 85 0 15112 3056 kqueue Is ? 0:00.08 |-- /usr/libexec/postfix/master -w
12 515 752 0 85 0 15768 4288 kqueue I ? 0:00.09 | |-- pickup -l -t unix -u
12 748 752 0 85 0 14168 4320 kqueue I ? 0:00.09 | `-- qmgr -l -t unix -u
0 765 1 0 85 0 6864 1896 nanoslp Ss ? 0:00.02 |-- /usr/sbin/cron
0 831 1 0 85 0 14984 4920 wait Is ttyE0 0:00.25 `-- login
0 760 831 0 85 0 8200 2464 wait S ttyE0 0:00.36 `-- -sh
0 948 760 0 43 0 5944 1672 - O+ ttyE0 0:00.01 `-- ps -axdl
+ +

ifconfig

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# ifconfig -am
ure0: flags=0x8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
capabilities=3ff00<IP4CSUM_Rx,IP4CSUM_Tx,TCP4CSUM_Rx,TCP4CSUM_Tx>
capabilities=3ff00<UDP4CSUM_Rx,UDP4CSUM_Tx,TCP6CSUM_Rx,TCP6CSUM_Tx>
capabilities=3ff00<UDP6CSUM_Rx,UDP6CSUM_Tx>
enabled=0
ec_capabilities=1<VLAN_MTU>
ec_enabled=0
address: 00:e0:4c:36:03:b4
media: Ethernet autoselect (100baseTX full-duplex)
status: active
supported Ethernet media:
media 10baseT
media 10baseT mediaopt full-duplex
media 100baseTX
media 100baseTX mediaopt full-duplex
media autoselect
inet6 fe80::8b76:8c43:8609:1582%ure0/64 flags 0x0 scopeid 0x1
inet6 2409:8a55:8bc:dda0:364e:fd36:9aea:b84b/64 flags 0x0
inet 192.168.1.10/24 broadcast 192.168.1.255 flags 0x0
lo0: flags=0x8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 33176
inet6 ::1/128 flags 0x20<NODAD>
inet6 fe80::1%lo0/64 flags 0x0 scopeid 0x2
inet 127.0.0.1/8 flags 0x0
+ +

Compiler

1
2
3
4
5
6
7
8
9
10
11
# ld -v
GNU ld (NetBSD Binutils nb1) 2.31.1

# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/lto-wrapper
Target: armv6--netbsdelf-eabihf
Configured with: /usr/src/tools/gcc/../../external/gpl3/gcc/dist/configure --target=armv6--netbsdelf-eabihf --enable-long-long --enable-threads --with-bugurl=http://www.NetBSD.org/Misc/send-pr.html --with-pkgversion='NetBSD nb4 20200810' --with-system-zlib --without-isl --enable-__cxa_atexit --enable-libstdcxx-time=rt --enable-libstdcxx-threads --with-diagnostics-color=auto-if-env --with-default-libstdcxx-abi=new --with-mpc-lib=/var/obj/mknative/evbarm-earmv6hf/usr/src/external/lgpl3/mpc/lib/libmpc --with-mpfr-lib=/var/obj/mknative/evbarm-earmv6hf/usr/src/external/lgpl3/mpfr/lib/libmpfr --with-gmp-lib=/var/obj/mknative/evbarm-earmv6hf/usr/src/external/lgpl3/gmp/lib/libgmp --with-mpc-include=/usr/src/external/lgpl3/mpc/dist/src --with-mpfr-include=/usr/src/external/lgpl3/mpfr/dist/src --with-gmp-include=/usr/src/external/lgpl3/gmp/lib/libgmp/arch/arm --enable-tls --enable-initfini-array --disable-multilib --disable-libstdcxx-pch --build=armv6--netbsdelf-eabihf --host=armv6--netbsdelf-eabihf --with-sysroot=/var/obj/mknative/evbarm-earmv6hf/usr/src/destdir.evbarm
Thread model: posix
gcc version 7.5.0 (nb4 20200810)
+ +

NetBSD Packages Collection

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
export PKG_PATH="http://cdn.NetBSD.org/pub/pkgsrc/packages/$(uname -s)/$(uname -m)/$(uname -r | cut -f '1 2' -d.)/All/"
export PKG_PATH="http://cdn.netbsd.org/pub/pkgsrc/packages/NetBSD/earmv6hf/9.1/All/;http://cdn.netbsd.org/pub/pkgsrc/packages/NetBSD/earmv6hf/9.0/All/"

pkg_admin fetch-pkg-vulnerabilities

pkg_add -uv tmux bash pkgin avahi clang python38

pkg_info tmux

pkg_delete -r jpeg

cat << EOF > /usr/pkg/etc/pkgin/repositories.conf
#
# Pkgin repositories list
#
# Simply add repositories URIs one below the other
#
# WARNING: order matters, duplicates will not be added, if two
# repositories hold the same package, it will be fetched from
# the first one listed in this file.
#

http://cdn.netbsd.org/pub/pkgsrc/packages/NetBSD/earmv6hf/9.1/All/
http://cdn.netbsd.org/pub/pkgsrc/packages/NetBSD/earmv6hf/9.0/All/
EOF

pkgin update
pkgin upgrade
pkgin avail
pkgin list
pkgin search foo.*bar
pkgin install 'foo<5.0' bar baz
pkgin show-full-deps foo
pkgin show-rev-deps foo
pkgin requires foo
pkgin remove foo
pkgin autoremove
pkgin clean
pkgin export > my-packages
pkgin import my-packages
pkgin provides foo
pkgin pkg-content foo
+ +

Conclusion

NetBSD 9.1 can use my Realtek RTL8152 Based USB Ethernet Adapter, it’s works very good.

+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/11/28/netbsd-9-aarch64-on-raspberry-pi-3b/index.html b/2020/11/28/netbsd-9-aarch64-on-raspberry-pi-3b/index.html new file mode 100644 index 00000000..c916871f --- /dev/null +++ b/2020/11/28/netbsd-9-aarch64-on-raspberry-pi-3b/index.html @@ -0,0 +1,287 @@ + + + + + + + + + + + + NetBSD 9 aarch64 on Raspberry Pi 3B+ | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ NetBSD 9 aarch64 on Raspberry Pi 3B+ +

+ +

NetBSD 9 aarch64 on Raspberry Pi 3B+

Download NetBSD image

+
1
2
3
$ aria2c https://cdn.netbsd.org/pub/NetBSD/NetBSD-9.1/evbarm-aarch64/binary/gzimg/arm64.img.gz

$ aria2c https://nycdn.netbsd.org/pub/NetBSD-daily/netbsd-9/latest/evbarm-aarch64/binary/gzimg/arm64.img.gz
+ +

Write image to SDXC card

1
2
3
4
5
6
7
8
9
$ cat arm64.img.gz | gzip -cd | sudo dd of=/dev/sdb bs=4M oflag=sync status=progress; time sync
1193705472 bytes (1.2 GB, 1.1 GiB) copied, 69 s, 17.3 MB/s
0+18388 records in
0+18388 records out
1204551680 bytes (1.2 GB, 1.1 GiB) copied, 69.6269 s, 17.3 MB/s

real 0m0.006s
user 0m0.000s
sys 0m0.001s
+ +

Booting Raspberry Pi

If you use USB TTL, don’t forgot connect GND, and cross-connect TXD and RXD, i.e.:

+
    +
  1. Connect Gnd Pin of converter to Gnd of Raspberry Pi.
  2. +
  3. Connect TXD pin of converter to RXD0 of Raspberry Pi.
  4. +
  5. Connect RXD pin of converter to TXD0 of Raspberry Pi.
  6. +
+

Raspberry Pi 3 B+ Pins

+

You also need to setup the serial terminal to following specs:

+
    +
  1. Baud rate = 115200,
  2. +
  3. Bits = 8,
  4. +
  5. Parity = None,
  6. +
  7. Stop bits = 1 and
  8. +
  9. Flow control = None.
  10. +
+
1
$ sudo minicom -b 115200 -8 -D /dev/ttyUSB0
+ +
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
[   1.0000000] NetBSD/evbarm (fdt) booting ...
[ 1.0000000] Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
[ 1.0000000] 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
[ 1.0000000] 2018, 2019, 2020 The NetBSD Foundation, Inc. All rights reserved.
[ 1.0000000] Copyright (c) 1982, 1986, 1989, 1991, 1993
[ 1.0000000] The Regents of the University of California. All rights reserved.

[ 1.0000000] NetBSD 9.1 (GENERIC64) #0: Sun Oct 18 19:24:30 UTC 2020
[ 1.0000000] mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/evbarm/compile/GENERIC64
[ 1.0000000] total memory = 933 MB
[ 1.0000000] avail memory = 900 MB
[ 1.0000000] running cgd selftest aes-xts-256 aes-xts-512 done
[ 1.0000000] armfdt0 (root)
[ 1.0000000] simplebus0 at armfdt0: Raspberry Pi 3 Model B Plus Rev 1.3
[ 1.0000000] simplebus1 at simplebus0
[ 1.0000000] simplebus2 at simplebus0
[ 1.0000000] cpus0 at simplebus0
[ 1.0000000] simplebus3 at simplebus0
[ 1.0000000] cpu0 at cpus0: Cortex-A53 r0p4 (Cortex V8-A core)
[ 1.0000000] cpu0: package 0, core 0, smt 0
[ 1.0000000] cpu0: IC enabled, DC enabled, EL0/EL1 stack Alignment check enabled
[ 1.0000000] cpu0: Cache Writeback Granule 16B, Exclusives Reservation Granule 16B
[ 1.0000000] cpu0: Dcache line 64, Icache line 64
[ 1.0000000] cpu0: L1 32KB/64B 2-way read-allocate VIPT Instruction cache
[ 1.0000000] cpu0: L1 32KB/64B 4-way write-back read-allocate write-allocate PIPT Data cache
[ 1.0000000] cpu0: L2 512KB/64B 16-way write-back read-allocate write-allocate PIPT Unified cache
[ 1.0000000] cpu0: revID=0x80, PMCv3, 4k table, 64k table, 16bit ASID
[ 1.0000000] cpu0: auxID=0x10000, FP, CRC32, NEON, rounding, NaN propagation, denormals, 32x64bitRegs, Fused Multiply-Add
[ 1.0000000] cpu1 at cpus0: Cortex-A53 r0p4 (Cortex V8-A core)
[ 1.0000000] cpu1: package 0, core 1, smt 0
[ 1.0000000] cpu2 at cpus0: Cortex-A53 r0p4 (Cortex V8-A core)
[ 1.0000000] cpu2: package 0, core 2, smt 0
[ 1.0000000] cpu3 at cpus0: Cortex-A53 r0p4 (Cortex V8-A core)
[ 1.0000000] cpu3: package 0, core 3, smt 0
[ 1.0000000] simplebus4 at simplebus1
[ 1.0000000] bcmicu0 at simplebus1
[ 1.0000000] bcmicu1 at simplebus1: Multiprocessor
[ 1.0000000] bcmcprman0 at simplebus1: BCM283x Clock Controller
[ 1.0000000] fclock0 at simplebus2: 19200000 Hz fixed clock (osc)
[ 1.0000000] bcmaux0 at simplebus1
[ 1.0000000] fclock1 at simplebus2: 480000000 Hz fixed clock (otg)
[ 1.0000000] gtmr0 at simplebus0: Generic Timer
[ 1.0000000] gtmr0: interrupting on local_intc irq 3
[ 1.0000000] armgtmr0 at gtmr0: Generic Timer (19200 kHz, virtual)
[ 1.0000030] plcom0 at simplebus1: ARM PL011 UART
[ 1.0000030] plcom0: txfifo disabled
[ 1.0000030] plcom0: interrupting on icu irq 185
[ 1.0000030] com0 at simplebus1: BCM AUX UART, working fifo
[ 1.0000030] com0: console
[ 1.0000030] com0: interrupting on icu irq 157
[ 1.0000030] mmcpwrseq0 at simplebus0: couldn't get reset GPIOs
[ 1.0000030] /soc/thermal@7e212000 at simplebus1 not configured
[ 1.0000030] /soc/dsi@7e209000 at simplebus1 not configured
[ 1.0000030] bcmgpio0 at simplebus1: GPIO controller
[ 1.0000030] bcmgpio0: pins 0..31 interrupting on icu irq 177
[ 1.0000030] bcmgpio0: pins 32..54 interrupting on icu irq 178
[ 1.0000030] gpio0 at bcmgpio0: 54 pins
[ 1.0000030] /soc/firmware/gpio at simplebus4 not configured
[ 1.0000030] bcmdmac0 at simplebus1: DMA0 DMA2 DMA4 DMA5 DMA8 DMA9 DMA10
[ 1.0000030] /soc/power at simplebus1 not configured
[ 1.0000030] bsciic0 at simplebus1: Broadcom Serial Controller
[ 1.0000030] iic0 at bsciic0: I2C bus
[ 1.0000030] /phy at simplebus0 not configured
[ 1.0000030] bcmpmwdog0 at simplebus1: Power management, Reset and Watchdog controller
[ 1.0000030] bcmmbox0 at simplebus1: VC mailbox
[ 1.0000030] bcmmbox0: interrupting on icu irq 193
[ 1.0000030] vcmbox0 at bcmmbox0
[ 1.0000030] bcmsdhost0 at simplebus1: SD HOST controller
[ 1.0000030] bcmsdhost0: interrupting on icu irq 184
[ 1.0000030] bsciic1 at simplebus1: Broadcom Serial Controller
[ 1.0000030] iic1 at bsciic1: I2C bus
[ 1.0000030] /soc/pwm@7e20c000 at simplebus1 not configured
[ 1.0000030] sdhc0 at simplebus1: SDHC controller
[ 1.0000030] sdhc0: interrupting on icu irq 190
[ 1.0000030] bsciic2 at simplebus1: Broadcom Serial Controller
[ 1.0000030] iic2 at bsciic2: I2C bus
[ 1.0000030] /soc/vec@7e806000 at simplebus1 not configured
[ 1.0000030] /soc/hdmi@7e902000 at simplebus1 not configured
[ 1.0000030] dwctwo0 at simplebus1: USB controller
[ 1.0000030] dwctwo0: interrupting on icu irq 137
[ 1.0000030] /soc/gpu at simplebus1 not configured
[ 1.0000030] genfb0 at simplebus1: switching to framebuffer console
[ 1.0000030] wsdisplay0 at genfb0 kbdmux 1: console (default, vt100 emulation)
[ 1.0000030] /soc/mailbox@7e00b840 at simplebus1 not configured
[ 1.0000030] armpmu0 at simplebus0: Performance Monitor Unit
[ 1.0000030] gpioleds0 at simplebus0: ACT
[ 1.0000030] /soc/timer@7e003000 at simplebus1 not configured
[ 1.0000030] /soc/txp@7e004000 at simplebus1 not configured
[ 1.0000030] bcmrng0 at simplebus1: RNG
[ 1.0000030] cpu1: IC enabled, DC enabled, EL0/EL1 stack Alignment check enabled
[ 1.3822156] cpu1: Cache Writeback Granule 16B, Exclusives Reservation Granule 16B
[ 1.4022184] cpu1: Dcache line 64, Icache line 64
[ 1.4222202] cpu1: L1 32KB/64B 2-way read-allocate VIPT Instruction cache
[ 1.4422221] cpu1: L1 32KB/64B 4-way write-back read-allocate write-allocate PIPT Data cache
[ 1.4622237] cpu1: L2 512KB/64B 16-way write-back read-allocate write-allocate PIPT Unified cache
[ 1.4922276] cpu1: revID=0x80, PMCv3, 4k table, 64k table, 16bit ASID
[ 1.5122299] cpu1: auxID=0x10000, FP, CRC32, NEON, rounding, NaN propagation, denormals, 32x64bitRegs, Fused Multiply-Add
[ 1.5522349] cpu2: IC enabled, DC enabled, EL0/EL1 stack Alignment check enabled
[ 1.5722364] cpu2: Cache Writeback Granule 16B, Exclusives Reservation Granule 16B
[ 1.5922378] cpu2: Dcache line 64, Icache line 64
[ 1.6122400] cpu2: L1 32KB/64B 2-way read-allocate VIPT Instruction cache
[ 1.6322417] cpu2: L1 32KB/64B 4-way write-back read-allocate write-allocate PIPT Data cache
[ 1.6622453] cpu2: L2 512KB/64B 16-way write-back read-allocate write-allocate PIPT Unified cache
[ 1.6922489] cpu2: revID=0x80, PMCv3, 4k table, 64k table, 16bit ASID
[ 1.7122507] cpu2: auxID=0x10000, FP, CRC32, NEON, rounding, NaN propagation, denormals, 32x64bitRegs, Fused Multiply-Add
[ 1.7522545] cpu3: IC enabled, DC enabled, EL0/EL1 stack Alignment check enabled
[ 1.7722565] cpu3: Cache Writeback Granule 16B, Exclusives Reservation Granule 16B
[ 1.8022588] cpu3: Dcache line 64, Icache line 64
[ 1.8122601] cpu3: L1 32KB/64B 2-way read-allocate VIPT Instruction cache
[ 1.8422639] cpu3: L1 32KB/64B 4-way write-back read-allocate write-allocate PIPT Data cache
[ 1.8622659] cpu3: L2 512KB/64B 16-way write-back read-allocate write-allocate PIPT Unified cache
[ 1.8922684] cpu3: revID=0x80, PMCv3, 4k table, 64k table, 16bit ASID
[ 1.9122707] cpu3: auxID=0x10000, FP, CRC32, NEON, rounding, NaN propagation, denormals, 32x64bitRegs, Fused Multiply-Add
[ 2.0122823] sdmmc0 at bcmsdhost0
[ 2.0122823] sdhc0: SDHC 3.0, rev 153, platform DMA, 200000 kHz, HS 3.3V, re-tuning mode 1, 1024 byte blocks
[ 2.0237139] sdmmc1 at sdhc0 slot 0
[ 2.0237139] usb0 at dwctwo0: USB revision 2.0
[ 2.0531467] armpmu0: interrupting on local_intc irq 9
[ 2.0531467] uhub0 at usb0: NetBSD (0000) DWC2 root hub (0000), class 9/0, rev 2.00/1.00, addr 1
[ 2.1331539] sdmmc0: direct I/O error 5, r=6 p=0xffffffc032d60e4c write
[ 2.1531565] sdmmc0: SD card status: 4-bit, C10, U1, V10, A1
[ 2.1631581] ld0 at sdmmc0: <0x27:0x5048:SD64G:0x60:0xda7f8e63:0x14a>
[ 2.1731600] ld0: 59616 MB, 7599 cyl, 255 head, 63 sec, 512 bytes/sect x 122093568 sectors
[ 2.1831597] ld0: 4-bit width, High-Speed/SDR25, 50.000 MHz
[ 2.2531660] sdmmc1: 4-bit width, 50.000 MHz
[ 2.2531660] sdmmc1: MAX_BLK_SIZE1 = 64
[ 2.2531660] sdmmc1: MAX_BLK_SIZE2 = 512
[ 2.2646882] sdmmc1: MAX_BLK_SIZE3 = 512
[ 2.2646882] sdmmc1: SDIO function
[ 2.2737676] (manufacturer 0x2d0, product 0xa9a6) at sdmmc1 function 1 not configured
[ 2.2737676] (manufacturer 0x2d0, product 0xa9a6) at sdmmc1 function 2 not configured
[ 2.2942676] (manufacturer 0x2d0, product 0xa9a6, standard function interface code 0x2) at sdmmc1 function 3 not configured
[ 3.8843969] uhub1 at uhub0 port 1: vendor 0424 (0x424) product 2514 (0x2514), class 9/0, rev 2.00/b.b3, addr 2
[ 3.8943974] uhub1: multiple transaction translators
[ 5.2145070] uhub2 at uhub1 port 1: vendor 0424 (0x424) product 2514 (0x2514), class 9/0, rev 2.00/b.b3, addr 3
[ 5.2245083] uhub2: multiple transaction translators
[ 6.5446609] uhub3 at uhub2 port 3: vendor 214b (0x214b) USB2.0 HUB (0x7250), class 9/0, rev 2.00/1.00, addr 4
[ 6.5546631] uhub3: single transaction translator
[ 7.8748387] ure0 at uhub3 port 1
[ 7.8848401] ure0: Realtek (0xbda) USB 10/100 LAN (0x8152), rev 2.10/20.00, addr 5
[ 7.8948410] ure0: RTL8152 ver 4c10
[ 7.9648503] rlphy0 at ure0 phy 0: RTL8201E 10/100 media interface, rev. 2
[ 7.9848541] rlphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
[ 7.9954319] ure0: Ethernet address 00:e0:4c:36:03:b4
[ 9.0249916] uhidev0 at uhub1 port 3 configuration 1 interface 0
[ 9.0249916] uhidev0: SIGMACHIP (0x1c4f) USB Keyboard (0x02), rev 1.10/1.10, addr 6, iclass 3/1
[ 9.0749989] ukbd0 at uhidev0
[ 9.4850529] wskbd0 at ukbd0: console keyboard, using wsdisplay0
[ 9.4850529] uhidev1 at uhub1 port 3 configuration 1 interface 1
[ 9.4951562] uhidev1: SIGMACHIP (0x1c4f) USB Keyboard (0x02), rev 1.10/1.10, addr 6, iclass 3/0
[ 9.5351599] uhidev1: 2 report ids
[ 9.5351599] uhid0 at uhidev1 reportid 1: input=2, output=0, feature=0
[ 9.5453441] uhid1 at uhidev1 reportid 2: input=1, output=0, feature=0
[ 9.5453441] uhub0: illegal enable change, port 1
[ 10.5254420] mue0 at uhub2 port 1
[ 10.5254420] mue0: vendor 0424 (0x424) product 7800 (0x7800), rev 2.10/3.00, addr 7
[ 10.8154803] mue0: LAN7800 id 0x7800 rev 0x2
[ 10.8254821] ukphy0 at mue0 phy 1: OUI 0x00800f, model 0x0013, rev. 2
[ 10.8254821] ukphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 1000baseT-FDX, auto
[ 10.8359002] mue0: Ethernet address b8:27:eb:66:13:38
[ 10.8559059] WARNING: 2 errors while detecting hardware; check system log.
[ 10.8559059] boot device: ld0
[ 10.8659071] root on ld0a dumps on ld0b
[ 10.8759115] root file system type: ffs
[ 10.8888685] kern.module.path=/stand/evbarm/9.1/modules
[ 10.8967343] WARNING: no TOD clock present
[ 10.8967343] WARNING: using filesystem time
[ 10.9049328] WARNING: CHECK AND RESET THE DATE!
Mon Oct 19 02:20:53 UTC 2020
Starting root file system check:
/dev/rld0a: file system is clean; not checking
Growing ld0 MBR partition #1 (1052MB -> 59520MB)
Growing ld0 disklabel (1148MB -> 59616MB)
Resizing /
reboot: rebooted by root
[ 201.1052241] rebooting...
[ 1.0000000] NetBSD/evbarm (fdt) booting ...
[ 1.0000000] Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
[ 1.0000000] 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
[ 1.0000000] 2018, 2019, 2020 The NetBSD Foundation, Inc. All rights reserved.
[ 1.0000000] Copyright (c) 1982, 1986, 1989, 1991, 1993
[ 1.0000000] The Regents of the University of California. All rights reserved.

[ 1.0000000] NetBSD 9.1 (GENERIC64) #0: Sun Oct 18 19:24:30 UTC 2020
[ 1.0000000] mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/evbarm/compile/GENERIC64
[ 1.0000000] total memory = 933 MB
[ 1.0000000] avail memory = 900 MB
[ 1.0000000] running cgd selftest aes-xts-256 aes-xts-512 done
[ 1.0000000] armfdt0 (root)
[ 1.0000000] simplebus0 at armfdt0: Raspberry Pi 3 Model B Plus Rev 1.3
[ 1.0000000] simplebus1 at simplebus0
[ 1.0000000] simplebus2 at simplebus0
[ 1.0000000] simplebus3 at simplebus1
[ 1.0000000] cpus0 at simplebus0
[ 1.0000000] simplebus4 at simplebus0
[ 1.0000000] cpu0 at cpus0: Cortex-A53 r0p4 (Cortex V8-A core)
[ 1.0000000] cpu0: package 0, core 0, smt 0
[ 1.0000000] cpu0: IC enabled, DC enabled, EL0/EL1 stack Alignment check enabled
[ 1.0000000] cpu0: Cache Writeback Granule 16B, Exclusives Reservation Granule 16B
[ 1.0000000] cpu0: Dcache line 64, Icache line 64
[ 1.0000000] cpu0: L1 32KB/64B 2-way read-allocate VIPT Instruction cache
[ 1.0000000] cpu0: L1 32KB/64B 4-way write-back read-allocate write-allocate PIPT Data cache
[ 1.0000000] cpu0: L2 512KB/64B 16-way write-back read-allocate write-allocate PIPT Unified cache
[ 1.0000000] cpu0: revID=0x80, PMCv3, 4k table, 64k table, 16bit ASID
[ 1.0000000] cpu0: auxID=0x10000, FP, CRC32, NEON, rounding, NaN propagation, denormals, 32x64bitRegs, Fused Multiply-Add
[ 1.0000000] cpu1 at cpus0: Cortex-A53 r0p4 (Cortex V8-A core)
[ 1.0000000] cpu1: package 0, core 1, smt 0
[ 1.0000000] cpu2 at cpus0: Cortex-A53 r0p4 (Cortex V8-A core)
[ 1.0000000] cpu2: package 0, core 2, smt 0
[ 1.0000000] cpu3 at cpus0: Cortex-A53 r0p4 (Cortex V8-A core)
[ 1.0000000] cpu3: package 0, core 3, smt 0
[ 1.0000000] bcmicu0 at simplebus1
[ 1.0000000] bcmicu1 at simplebus1: Multiprocessor
[ 1.0000000] bcmcprman0 at simplebus1: BCM283x Clock Controller
[ 1.0000000] fclock0 at simplebus2: 19200000 Hz fixed clock (osc)
[ 1.0000000] bcmaux0 at simplebus1
[ 1.0000000] fclock1 at simplebus2: 480000000 Hz fixed clock (otg)
[ 1.0000000] gtmr0 at simplebus0: Generic Timer
[ 1.0000000] gtmr0: interrupting on local_intc irq 3
[ 1.0000000] armgtmr0 at gtmr0: Generic Timer (19200 kHz, virtual)
[ 1.0000030] plcom0 at simplebus1: ARM PL011 UART
[ 1.0000030] plcom0: txfifo disabled
[ 1.0000030] plcom0: interrupting on icu irq 185
[ 1.0000030] com0 at simplebus1: BCM AUX UART, working fifo
[ 1.0000030] com0: console
[ 1.0000030] com0: interrupting on icu irq 157
[ 1.0000030] mmcpwrseq0 at simplebus0: couldn't get reset GPIOs
[ 1.0000030] /soc/thermal@7e212000 at simplebus1 not configured
[ 1.0000030] /soc/dsi@7e209000 at simplebus1 not configured
[ 1.0000030] bcmgpio0 at simplebus1: GPIO controller
[ 1.0000030] bcmgpio0: pins 0..31 interrupting on icu irq 177
[ 1.0000030] bcmgpio0: pins 32..54 interrupting on icu irq 178
[ 1.0000030] gpio0 at bcmgpio0: 54 pins
[ 1.0000030] /soc/firmware/gpio at simplebus3 not configured
[ 1.0000030] bcmdmac0 at simplebus1: DMA0 DMA2 DMA4 DMA5 DMA8 DMA9 DMA10
[ 1.0000030] /soc/power at simplebus1 not configured
[ 1.0000030] bsciic0 at simplebus1: Broadcom Serial Controller
[ 1.0000030] iic0 at bsciic0: I2C bus
[ 1.0000030] /phy at simplebus0 not configured
[ 1.0000030] bcmpmwdog0 at simplebus1: Power management, Reset and Watchdog controller
[ 1.0000030] bcmmbox0 at simplebus1: VC mailbox
[ 1.0000030] bcmmbox0: interrupting on icu irq 193
[ 1.0000030] vcmbox0 at bcmmbox0
[ 1.0000030] bcmsdhost0 at simplebus1: SD HOST controller
[ 1.0000030] bcmsdhost0: interrupting on icu irq 184
[ 1.0000030] bsciic1 at simplebus1: Broadcom Serial Controller
[ 1.0000030] iic1 at bsciic1: I2C bus
[ 1.0000030] /soc/pwm@7e20c000 at simplebus1 not configured
[ 1.0000030] sdhc0 at simplebus1: SDHC controller
[ 1.0000030] sdhc0: interrupting on icu irq 190
[ 1.0000030] bsciic2 at simplebus1: Broadcom Serial Controller
[ 1.0000030] iic2 at bsciic2: I2C bus
[ 1.0000030] /soc/vec@7e806000 at simplebus1 not configured
[ 1.0000030] /soc/hdmi@7e902000 at simplebus1 not configured
[ 1.0000030] dwctwo0 at simplebus1: USB controller
[ 1.0000030] dwctwo0: interrupting on icu irq 137
[ 1.0000030] /soc/gpu at simplebus1 not configured
[ 1.0000030] genfb0 at simplebus1: switching to framebuffer console
[ 1.0000030] wsdisplay0 at genfb0 kbdmux 1: console (default, vt100 emulation)
[ 1.0000030] /soc/mailbox@7e00b840 at simplebus1 not configured
[ 1.0000030] armpmu0 at simplebus0: Performance Monitor Unit
[ 1.0000030] gpioleds0 at simplebus0: ACT
[ 1.0000030] /soc/timer@7e003000 at simplebus1 not configured
[ 1.0000030] /soc/txp@7e004000 at simplebus1 not configured
[ 1.0000030] bcmrng0 at simplebus1: RNG
[ 1.0000030] cpu2: IC enabled, DC enabled, EL0/EL1 stack Alignment check enabled
[ 1.4189881] cpu2: Cache Writeback Granule 16B, Exclusives Reservation Granule 16B
[ 1.4389903] cpu2: Dcache line 64, Icache line 64
[ 1.4589926] cpu2: L1 32KB/64B 2-way read-allocate VIPT Instruction cache
[ 1.4789951] cpu2: L1 32KB/64B 4-way write-back read-allocate write-allocate PIPT Data cache
[ 1.4989968] cpu2: L2 512KB/64B 16-way write-back read-allocate write-allocate PIPT Unified cache
[ 1.5290001] cpu2: revID=0x80, PMCv3, 4k table, 64k table, 16bit ASID
[ 1.5490016] cpu2: auxID=0x10000, FP, CRC32, NEON, rounding, NaN propagation, denormals, 32x64bitRegs, Fused Multiply-Add
[ 1.5890059] cpu1: IC enabled, DC enabled, EL0/EL1 stack Alignment check enabled
[ 1.6090086] cpu1: Cache Writeback Granule 16B, Exclusives Reservation Granule 16B
[ 1.6290103] cpu1: Dcache line 64, Icache line 64
[ 1.6490124] cpu1: L1 32KB/64B 2-way read-allocate VIPT Instruction cache
[ 1.6690139] cpu1: L1 32KB/64B 4-way write-back read-allocate write-allocate PIPT Data cache
[ 1.6990171] cpu1: L2 512KB/64B 16-way write-back read-allocate write-allocate PIPT Unified cache
[ 1.7290192] cpu1: revID=0x80, PMCv3, 4k table, 64k table, 16bit ASID
[ 1.7490237] cpu1: auxID=0x10000, FP, CRC32, NEON, rounding, NaN propagation, denormals, 32x64bitRegs, Fused Multiply-Add
[ 1.7890273] cpu3: IC enabled, DC enabled, EL0/EL1 stack Alignment check enabled
[ 1.8090291] cpu3: Cache Writeback Granule 16B, Exclusives Reservation Granule 16B
[ 1.8390323] cpu3: Dcache line 64, Icache line 64
[ 1.8490327] cpu3: L1 32KB/64B 2-way read-allocate VIPT Instruction cache
[ 1.8790361] cpu3: L1 32KB/64B 4-way write-back read-allocate write-allocate PIPT Data cache
[ 1.8990385] cpu3: L2 512KB/64B 16-way write-back read-allocate write-allocate PIPT Unified cache
[ 1.9290404] cpu3: revID=0x80, PMCv3, 4k table, 64k table, 16bit ASID
[ 1.9490427] cpu3: auxID=0x10000, FP, CRC32, NEON, rounding, NaN propagation, denormals, 32x64bitRegs, Fused Multiply-Add
[ 2.0590540] sdmmc0 at bcmsdhost0
[ 2.0590540] sdhc0: SDHC 3.0, rev 153, platform DMA, 200000 kHz, HS 3.3V, re-tuning mode 1, 1024 byte blocks
[ 2.0795260] sdmmc1 at sdhc0 slot 0
[ 2.0795260] usb0 at dwctwo0: USB revision 2.0
[ 2.0990667] armpmu0: interrupting on local_intc irq 9
[ 2.1090670] uhub0 at usb0: NetBSD (0000) DWC2 root hub (0000), class 9/0, rev 2.00/1.00, addr 1
[ 2.1790721] sdmmc0: direct I/O error 5, r=6 p=0xffffffc032d60e4c write
[ 2.2090760] sdmmc0: SD card status: 4-bit, C10, U1, V10, A1
[ 2.2090760] ld0 at sdmmc0: <0x27:0x5048:SD64G:0x60:0xda7f8e63:0x14a>
[ 2.2190769] ld0: 59616 MB, 7599 cyl, 255 head, 63 sec, 512 bytes/sect x 122093568 sectors
[ 2.2290770] ld0: 4-bit width, High-Speed/SDR25, 50.000 MHz
[ 2.2990837] sdmmc1: 4-bit width, 50.000 MHz
[ 2.2990837] sdmmc1: MAX_BLK_SIZE1 = 64
[ 2.3101078] sdmmc1: MAX_BLK_SIZE2 = 512
[ 2.3101078] sdmmc1: MAX_BLK_SIZE3 = 512
[ 2.3101078] sdmmc1: SDIO function
[ 2.3212059] (manufacturer 0x2d0, product 0xa9a6) at sdmmc1 function 1 not configured
[ 2.3212059] (manufacturer 0x2d0, product 0xa9a6) at sdmmc1 function 2 not configured
[ 2.3406603] (manufacturer 0x2d0, product 0xa9a6, standard function interface code 0x2) at sdmmc1 function 3 not configured
[ 3.9607932] uhub1 at uhub0 port 1: vendor 0424 (0x424) product 2514 (0x2514), class 9/0, rev 2.00/b.b3, addr 2
[ 3.9707941] uhub1: multiple transaction translators
[ 5.2909041] uhub2 at uhub1 port 1: vendor 0424 (0x424) product 2514 (0x2514), class 9/0, rev 2.00/b.b3, addr 3
[ 5.3009059] uhub2: multiple transaction translators
[ 6.6310827] uhub3 at uhub2 port 3: vendor 214b (0x214b) USB2.0 HUB (0x7250), class 9/0, rev 2.00/1.00, addr 4
[ 6.6410842] uhub3: single transaction translator
[ 7.9612599] ure0 at uhub3 port 1
[ 7.9612599] ure0: Realtek (0xbda) USB 10/100 LAN (0x8152), rev 2.10/20.00, addr 5
[ 7.9812634] ure0: RTL8152 ver 4c10
[ 8.0412708] rlphy0 at ure0 phy 0: RTL8201E 10/100 media interface, rev. 2
[ 8.0612739] rlphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
[ 8.0712753] ure0: Ethernet address 00:e0:4c:36:03:b4
[ 9.1014122] uhidev0 at uhub1 port 3 configuration 1 interface 0
[ 9.1014122] uhidev0: SIGMACHIP (0x1c4f) USB Keyboard (0x02), rev 1.10/1.10, addr 6, iclass 3/1
[ 9.1514190] ukbd0 at uhidev0
[ 9.5614737] wskbd0 at ukbd0: console keyboard, using wsdisplay0
[ 9.5614737] uhidev1 at uhub1 port 3 configuration 1 interface 1
[ 9.5715696] uhidev1: SIGMACHIP (0x1c4f) USB Keyboard (0x02), rev 1.10/1.10, addr 6, iclass 3/0
[ 9.6115721] uhidev1: 2 report ids
[ 9.6115721] uhid0 at uhidev1 reportid 1: input=2, output=0, feature=0
[ 9.6115721] uhid1 at uhidev1 reportid 2: input=1, output=0, feature=0
[ 9.6235892] uhub0: illegal enable change, port 1
[ 10.6021321] mue0 at uhub2 port 1
[ 10.6021321] mue0: vendor 0424 (0x424) product 7800 (0x7800), rev 2.10/3.00, addr 7
[ 10.8921574] mue0: LAN7800 id 0x7800 rev 0x2
[ 10.9021599] ukphy0 at mue0 phy 1: OUI 0x00800f, model 0x0013, rev. 2
[ 10.9021599] ukphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 1000baseT-FDX, auto
[ 10.9128211] mue0: Ethernet address b8:27:eb:66:13:38
[ 10.9328228] WARNING: 2 errors while detecting hardware; check system log.
[ 10.9328228] boot device: ld0
[ 10.9428244] root on ld0a dumps on ld0b
[ 10.9528240] root file system type: ffs
[ 10.9628260] kern.module.path=/stand/evbarm/9.1/modules
[ 10.9628260] WARNING: no TOD clock present
[ 10.9728256] WARNING: using filesystem time
[ 10.9797371] WARNING: CHECK AND RESET THE DATE!
Mon Oct 19 02:20:54 UTC 2020
Starting root file system check:
/dev/rld0a: file system is clean; not checking
fdisk: Cannot determine the number of heads
Not resizing /: already correct size
Starting file system checks:
/dev/rld0e: 92 files, 61668 free (15417 clusters)
random_seed: /var/db/entropy-file: Not present
Setting tty flags.
Setting sysctl variables:
ddb.onpanic: 1 -> 0
Starting network.
Hostname: arm64
IPv6 mode: host
Configuring network interfaces:.
Adding interface aliases:.
Waiting for DAD to complete for statically configured addresses...
Starting dhcpcd.
Starting mdnsd.
Building databases: dev, utmp, utmpx, services.
wsconscfg: screen 1 is already configured
wsconscfg: screen 2 is already configured
wsconscfg: screen 3 is already configured
Starting syslogd.
Mounting all file systems...
Clearing temporary files.
done.
Checking quotas: done.
Setting securelevel: kern.securelevel: 0 -> 1
Starting virecover.
Starting devpubd.
Starting local daemons:.
Updating motd.
Starting ntpd.
ssh-keygen: 1024 SHA256:5qTSr5sYztHHHAeWznv1Q1KnaL83YIgPZLiC8Tbp5H0 root@arm64 (DSA)
ssh-keygen: 521 SHA256:CW5iq1aPZtxw/gWfYWf6gg4diG8h2lZQM3ZphX7+GZs root@arm64 (ECDSA)
ssh-keygen: 256 SHA256:9gyB3RMi0TzbFyt6rPzMXFkIddbrajegXnclh/wss4c root@arm64 (ED25519)
ssh-keygen: 3072 SHA256:fbRm+YiCX6zKYm1CNU2dY5Cm3+XKOfMVSsNm9xM0tno root@arm64 (RSA)
Starting sshd.
postfix: rebuilding /etc/mail/aliases (missing /etc/mail/aliases.db)
Starting postfix.
Starting inetd.
Starting cron.
Mon Oct 19 02:21:43 UTC 2020

NetBSD/evbarm (arm64) (constty)

login: root
Nov 29 14:57:30 arm64 login: ROOT LOGIN (root) on tty constty
Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
2018, 2019, 2020 The NetBSD Foundation, Inc. All rights reserved.
Copyright (c) 1982, 1986, 1989, 1991, 1993
The Regents of the University of California. All rights reserved.

NetBSD 9.1 (GENERIC64) #0: Sun Oct 18 19:24:30 UTC 2020

Welcome to NetBSD!

We recommend that you create a non-root account and use su(1) for root access.
+ +

Logging in to NetBSD

The default account for the images are root without password.

+

You must set the password and configure ssh to allow root login before you can log in remotely.

+
1
2
3
4
5
6
# vi /etc/ssh/sshd_config
PermitRootLogin yes
#PermitRootLogin prohibit-password

# /etc/rc.d/sshd reload
Reloading sshd config files.
+ +

System characteristics

dimension

Raspberry Pi 3 B+ Dimension

+

uname

1
2
3
4
5
# uname -snrmp
NetBSD arm64 9.1 evbarm aarch64

# uname -ap
NetBSD arm64 9.1 NetBSD 9.1 (GENERIC64) #0: Sun Oct 18 19:24:30 UTC 2020 mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/evbarm/compile/GENERIC64 evbarm aarch64
+ +

cpu

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# dmesg | grep cpu
[ 1.000000] cpus0 at simplebus0
[ 1.000000] cpu0 at cpus0: Cortex-A53 r0p4 (Cortex V8-A core)
[ 1.000000] cpu0: package 0, core 0, smt 0
[ 1.000000] cpu0: IC enabled, DC enabled, EL0/EL1 stack Alignment check enabled
[ 1.000000] cpu0: Cache Writeback Granule 16B, Exclusives Reservation Granule 16B
[ 1.000000] cpu0: Dcache line 64, Icache line 64
[ 1.000000] cpu0: L1 32KB/64B 2-way read-allocate VIPT Instruction cache
[ 1.000000] cpu0: L1 32KB/64B 4-way write-back read-allocate write-allocate PIPT Data cache
[ 1.000000] cpu0: L2 512KB/64B 16-way write-back read-allocate write-allocate PIPT Unified cache
[ 1.000000] cpu0: revID=0x80, PMCv3, 4k table, 64k table, 16bit ASID
[ 1.000000] cpu0: auxID=0x10000, FP, CRC32, NEON, rounding, NaN propagation, denormals, 32x64bitRegs, Fused Multiply-Add
[ 1.000000] cpu1 at cpus0: Cortex-A53 r0p4 (Cortex V8-A core)
[ 1.000000] cpu1: package 0, core 1, smt 0
[ 1.000000] cpu2 at cpus0: Cortex-A53 r0p4 (Cortex V8-A core)
[ 1.000000] cpu2: package 0, core 2, smt 0
[ 1.000000] cpu3 at cpus0: Cortex-A53 r0p4 (Cortex V8-A core)
[ 1.000000] cpu3: package 0, core 3, smt 0
[ 1.000003] cpu1: IC enabled, DC enabled, EL0/EL1 stack Alignment check enabled
[ 1.382216] cpu1: Cache Writeback Granule 16B, Exclusives Reservation Granule 16B
[ 1.402218] cpu1: Dcache line 64, Icache line 64
[ 1.422220] cpu1: L1 32KB/64B 2-way read-allocate VIPT Instruction cache
[ 1.442222] cpu1: L1 32KB/64B 4-way write-back read-allocate write-allocate PIPT Data cache
[ 1.462224] cpu1: L2 512KB/64B 16-way write-back read-allocate write-allocate PIPT Unified cache
[ 1.492228] cpu1: revID=0x80, PMCv3, 4k table, 64k table, 16bit ASID
[ 1.512230] cpu1: auxID=0x10000, FP, CRC32, NEON, rounding, NaN propagation, denormals, 32x64bitRegs, Fused Multiply-Add
[ 1.552235] cpu2: IC enabled, DC enabled, EL0/EL1 stack Alignment check enabled
[ 1.572236] cpu2: Cache Writeback Granule 16B, Exclusives Reservation Granule 16B
[ 1.592238] cpu2: Dcache line 64, Icache line 64
[ 1.612240] cpu2: L1 32KB/64B 2-way read-allocate VIPT Instruction cache
[ 1.632242] cpu2: L1 32KB/64B 4-way write-back read-allocate write-allocate PIPT Data cache
[ 1.662245] cpu2: L2 512KB/64B 16-way write-back read-allocate write-allocate PIPT Unified cache
[ 1.692249] cpu2: revID=0x80, PMCv3, 4k table, 64k table, 16bit ASID
[ 1.712251] cpu2: auxID=0x10000, FP, CRC32, NEON, rounding, NaN propagation, denormals, 32x64bitRegs, Fused Multiply-Add
[ 1.752254] cpu3: IC enabled, DC enabled, EL0/EL1 stack Alignment check enabled
[ 1.772256] cpu3: Cache Writeback Granule 16B, Exclusives Reservation Granule 16B
[ 1.802259] cpu3: Dcache line 64, Icache line 64
[ 1.812260] cpu3: L1 32KB/64B 2-way read-allocate VIPT Instruction cache
[ 1.842264] cpu3: L1 32KB/64B 4-way write-back read-allocate write-allocate PIPT Data cache
[ 1.862266] cpu3: L2 512KB/64B 16-way write-back read-allocate write-allocate PIPT Unified cache
[ 1.892268] cpu3: revID=0x80, PMCv3, 4k table, 64k table, 16bit ASID
[ 1.912271] cpu3: auxID=0x10000, FP, CRC32, NEON, rounding, NaN propagation, denormals, 32x64bitRegs, Fused Multiply-Add
+ +

memory

1
2
3
4
5
6
7
8
9
10
11
# cat /proc/meminfo
total: used: free: shared: buffers: cached:
Mem: 944205824 275148800 669057024 0 191070208 235098112
Swap: 0 0 0
MemTotal: 922076 kB
MemFree: 653376 kB
MemShared: 0 kB
Buffers: 186592 kB
Cached: 229588 kB
SwapTotal: 0 kB
SwapFree: 0 kB
+ +

ure

Realtek RTL8152 Based USB Ethernet Adapter

+
1
2
3
4
5
6
7
8
9
10
11
12
13
# dmesg | grep ure0
[ 7.874839] ure0 at uhub3 port 1
[ 7.884840] ure0: Realtek (0xbda) USB 10/100 LAN (0x8152), rev 2.10/20.00, addr 5
[ 7.894841] ure0: RTL8152 ver 4c10
[ 7.964850] rlphy0 at ure0 phy 0: RTL8201E 10/100 media interface, rev. 2
[ 7.995432] ure0: Ethernet address 00:e0:4c:36:03:b4

# dmesg | grep mue0
[ 10.525442] mue0 at uhub2 port 1
[ 10.525442] mue0: vendor 0424 (0x424) product 7800 (0x7800), rev 2.10/3.00, addr 7
[ 10.815480] mue0: LAN7800 id 0x7800 rev 0x2
[ 10.825482] ukphy0 at mue0 phy 1: OUI 0x00800f, model 0x0013, rev. 2
[ 10.835900] mue0: Ethernet address b8:27:eb:66:13:38
+ +

sysctl

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
hw.disknames = ld0
hw.machine = evbarm
hw.machine_arch = aarch64
hw.model = raspberrypi,3-model-b-plus
hw.ncpu = 4
hw.ncpuonline = 4
hw.pagesize = 4096
hw.physmem = 979247104
hw.physmem64 = 979247104
hw.usermem = 955142144
hw.usermem64 = 955142144
kern.aio_listio_max = 512
kern.aio_max = 8192
kern.arandom = 1065677498
kern.argmax = 262144
kern.ccpu = 1948
kern.clockrate: tick = 10000, tickadj = 40, hz = 100, profhz = 100, stathz = 100
kern.configname = GENERIC64
kern.consdev = ttyE0
kern.dump_on_panic = 1
kern.expose_address = 1
kern.forkfsleep = 0
kern.fscale = 2048
kern.fsync = 1
kern.hardclock_ticks = 70391
kern.iov_max = 1024
kern.mbuf.mblowat = 16
kern.mbuf.mclbytes = 2048
kern.mbuf.mcllowat = 8
kern.mbuf.msize = 512
kern.mbuf.nmbclusters = 29884
kern.osrelease = 9.1
kern.osrevision = 901000000
kern.ostype = NetBSD
kern.timecounter.choice = clockinterrupt(q=0, f=100 Hz) armgtmr0(q=500, f=19200000 Hz) dummy(q=-1000000, f=1000000 Hz)
kern.timecounter.hardware = armgtmr0
kern.timecounter.timestepwarnings = 0
kern.version = NetBSD 9.1 (GENERIC64) #0: Sun Oct 18 19:24:30 UTC 2020
machdep.board_model = 0
machdep.board_revision = 10494163
machdep.cpu.frequency.available = 600 1400
machdep.cpu.frequency.current = 600
machdep.cpu.frequency.max = 1400
machdep.cpu.frequency.min = 600
machdep.cpu.frequency.target = 600
machdep.firmware_revision = 1536600398
machdep.serial = 0x66661338
+ +

mmc

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# dmesg | grep mmc
[ 1.000003] mmcpwrseq0 at simplebus0autoconfiguration error: : couldn't get reset GPIOs
[ 2.012282] sdmmc0 at bcmsdhost0
[ 2.023714] sdmmc1 at sdhc0 slot 0
[ 2.133154] sdmmc0: direct I/O error 5, r=6 p=0xffffffc032d60e4c write
[ 2.153156] sdmmc0: SD card status: 4-bit, C10, U1, V10, A1
[ 2.163158] ld0 at sdmmc0: <0x27:0x5048:SD64G:0x60:0xda7f8e63:0x14a>
[ 2.253166] sdmmc1: 4-bit width, 50.000 MHz
[ 2.253166] sdmmc1: MAX_BLK_SIZE1 = 64
[ 2.253166] sdmmc1: MAX_BLK_SIZE2 = 512
[ 2.264688] sdmmc1: MAX_BLK_SIZE3 = 512
[ 2.264688] sdmmc1: SDIO function
[ 2.273768] (manufacturer 0x2d0, product 0xa9a6) at sdmmc1 function 1 not configured
[ 2.273768] (manufacturer 0x2d0, product 0xa9a6) at sdmmc1 function 2 not configured
[ 2.294268] (manufacturer 0x2d0, product 0xa9a6, standard function interface code 0x2) at sdmmc1 function 3 not configured
+ +

mounts

1
2
3
4
5
6
7
# cat /proc/mounts
/dev/ld0a / ffs rw,noatime 0 0
/dev/ld0e /boot msdos rw 0 0
kernfs /kern kernfs rw 0 0
ptyfs /dev/pts ptyfs rw 0 0
procfs /proc proc rw 0 0
tmpfs /var/shm tmpfs rw 0 0
+ +

fdisk

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# fdisk /dev/rld0
Disk: /dev/rld0
NetBSD disklabel disk geometry:
cylinders: 7599, heads: 255, sectors/track: 63 (16065 sectors/cylinder)
total sectors: 122093568, bytes/sector: 512

BIOS disk geometry:
cylinders: 1023, heads: 255, sectors/track: 63 (16065 sectors/cylinder)
total sectors: 122093568

Partitions aligned to 2048 sector boundaries, offset 63

Partition table:
0: Primary DOS with 32 bit FAT - LBA (sysid 12)
start 32768, size 163840 (80 MB, Cyls 2/10/9-12/60/48), Active
1: NetBSD (sysid 169)
start 196608, size 121896960 (59520 MB, Cyls 12/60/49-7599/248/9)
PBR is not bootable: All bytes are identical (0x00)
2: <UNUSED>
3: <UNUSED>
First active partition: 0
Drive serial number: 0 (0x00000000)
+ +

disklabel

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# disklabel /dev/ld0
# /dev/ld0:
type: SCSI
disk: STORAGE DEVICE
label: fictitious
flags: removable
bytes/sector: 512
sectors/track: 32
tracks/cylinder: 64
sectors/cylinder: 2048
cylinders: 1148
total sectors: 122093568
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0 # microseconds
track-to-track seek: 0 # microseconds
drivedata: 0

8 partitions:
# size offset fstype [fsize bsize cpg/sgs]
a: 121896960 196608 4.2BSD 0 0 0 # (Cyl. 96 - 59615)
c: 122093568 0 unused 0 0 # (Cyl. 0 - 59615)
d: 122093568 0 unused 0 0 # (Cyl. 0 - 59615)
e: 163840 32768 MSDOS # (Cyl. 16 - 95)
+ +

List of processes after startup

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# ps -axdl
UID PID PPID CPU PRI NI VSZ RSS WCHAN STAT TTY TIME COMMAND
0 0 0 0 0 0 0 31148 - OKl ? 0:08.60 [system]
0 1 0 0 85 0 12092 1584 wait Is ? 0:00.02 - init
0 252 1 0 85 0 19228 1920 kqueue Ss ? 0:00.16 |-- dhcpcd: [master] [ip4] [ip6]
32767 255 1 0 85 0 15120 2136 select Ss ? 0:00.14 |-- /usr/sbin/mdnsd
0 306 1 0 85 0 18944 2332 kqueue Ss ? 0:00.27 |-- /usr/sbin/syslogd -s
0 462 1 3142 85 0 14084 828 devmon Is ? 0:00.00 |-- /sbin/devpubd
0 520 1 0 85 0 24248 6080 select Ss ? 0:00.13 |-- /usr/sbin/sshd
0 597 1 0 85 0 20320 23540 pause Ss ? 0:00.30 |-- /usr/sbin/ntpd -p /var/run/ntpd.pid -g
0 785 1 0 85 0 28752 2784 kqueue Ss ? 0:00.05 |-- /usr/libexec/postfix/master -w
12 873 785 0 85 0 23532 4656 kqueue I ? 0:00.07 | |-- qmgr -l -t unix -u
12 880 785 0 85 0 25008 4656 kqueue S ? 0:00.06 | `-- pickup -l -t unix -u
0 876 1 10611 83 0 17668 1364 kqueue Is ? 0:00.01 |-- /usr/sbin/inetd -l
0 1037 1 0 85 0 17896 1632 nanoslp Is ? 0:00.02 |-- /usr/sbin/cron
0 1046 1 4912 84 0 23168 4728 wait Is ttyE0 0:00.13 `-- login
0 771 1046 0 85 0 15812 2072 wait S ttyE0 0:00.14 `-- -sh
0 203 771 1024 42 0 13840 1572 - O+ ttyE0 0:00.02 `-- ps -axdl

+ +

ifconfig

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# ifconfig -am
ure0: flags=0x8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
capabilities=3ff00<IP4CSUM_Rx,IP4CSUM_Tx,TCP4CSUM_Rx,TCP4CSUM_Tx>
capabilities=3ff00<UDP4CSUM_Rx,UDP4CSUM_Tx,TCP6CSUM_Rx,TCP6CSUM_Tx>
capabilities=3ff00<UDP6CSUM_Rx,UDP6CSUM_Tx>
enabled=0
ec_capabilities=1<VLAN_MTU>
ec_enabled=0
address: 00:e0:4c:36:03:b4
media: Ethernet autoselect (none)
status: no carrier
supported Ethernet media:
media 10baseT
media 10baseT mediaopt full-duplex
media 100baseTX
media 100baseTX mediaopt full-duplex
media autoselect
mue0: flags=0x8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
capabilities=7ff80<TSO4,IP4CSUM_Rx,IP4CSUM_Tx,TCP4CSUM_Rx>
capabilities=7ff80<TCP4CSUM_Tx,UDP4CSUM_Rx,UDP4CSUM_Tx,TCP6CSUM_Rx>
capabilities=7ff80<TCP6CSUM_Tx,UDP6CSUM_Rx,UDP6CSUM_Tx,TSO6>
enabled=0
ec_capabilities=1<VLAN_MTU>
ec_enabled=0
address: b8:27:eb:66:13:38
media: Ethernet autoselect (100baseTX full-duplex)
status: active
supported Ethernet media:
media none
media 10baseT
media 10baseT mediaopt full-duplex
media 100baseTX
media 100baseTX mediaopt full-duplex
media 1000baseT
media 1000baseT mediaopt full-duplex
media autoselect
inet6 fe80::4dbc:22c8:4e8c:5d18%mue0/64 flags 0x0 scopeid 0x2
inet6 2409:8a55:8bc:dda0:252:275b:2061:5757/64 flags 0x0
inet 192.168.1.5/24 broadcast 192.168.1.255 flags 0x0
lo0: flags=0x8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 33624
inet6 ::1/128 flags 0x20<NODAD>
inet6 fe80::1%lo0/64 flags 0x0 scopeid 0x3
inet 127.0.0.1/8 flags 0x0
+ +

Compiler

1
2
3
4
5
6
7
8
9
10
11
# ld -v
GNU ld (NetBSD Binutils nb1) 2.31.1

# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/lto-wrapper
Target: aarch64--netbsd
Configured with: /usr/src/tools/gcc/../../external/gpl3/gcc/dist/configure --target=aarch64--netbsd --enable-long-long --enable-threads --with-bugurl=http://www.NetBSD.org/Misc/send-pr.html --with-pkgversion='NetBSD nb4 20200810' --with-system-zlib --without-isl --enable-__cxa_atexit --enable-libstdcxx-time=rt --enable-libstdcxx-threads --with-diagnostics-color=auto-if-env --enable-fix-cortex-a53-835769 --enable-fix-cortex-a53-843419 --with-default-libstdcxx-abi=new --with-mpc-lib=/var/obj/mknative/evbarm-aarch64/usr/src/external/lgpl3/mpc/lib/libmpc --with-mpfr-lib=/var/obj/mknative/evbarm-aarch64/usr/src/external/lgpl3/mpfr/lib/libmpfr --with-gmp-lib=/var/obj/mknative/evbarm-aarch64/usr/src/external/lgpl3/gmp/lib/libgmp --with-mpc-include=/usr/src/external/lgpl3/mpc/dist/src --with-mpfr-include=/usr/src/external/lgpl3/mpfr/dist/src --with-gmp-include=/usr/src/external/lgpl3/gmp/lib/libgmp/arch/aarch64 --enable-tls --disable-multilib --disable-libstdcxx-pch --build=aarch64--netbsd --host=aarch64--netbsd --with-sysroot=/var/obj/mknative/evbarm-aarch64/usr/src/destdir.evbarm
Thread model: posix
gcc version 7.5.0 (nb4 20200810)
+ +

NetBSD Packages Collection

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
export PKG_PATH="http://cdn.NetBSD.org/pub/pkgsrc/packages/$(uname -s)/$(uname -p)/$(uname -r | cut -f '1 2' -d.)/All/"
export PKG_PATH="http://cdn.netbsd.org/pub/pkgsrc/packages/NetBSD/aarch64/9.1/All/;http://cdn.netbsd.org/pub/pkgsrc/packages/NetBSD/aarch64/9.0/All/"

pkg_admin fetch-pkg-vulnerabilities

pkg_add -uv tmux bash pkgin avahi clang python38

pkg_info tmux

pkg_delete -r jpeg

cat << EOF > /usr/pkg/etc/pkgin/repositories.conf
#
# Pkgin repositories list
#
# Simply add repositories URIs one below the other
#
# WARNING: order matters, duplicates will not be added, if two
# repositories hold the same package, it will be fetched from
# the first one listed in this file.
#

http://cdn.netbsd.org/pub/pkgsrc/packages/NetBSD/earmv7hf/9.1/All/
http://cdn.netbsd.org/pub/pkgsrc/packages/NetBSD/earmv7hf/9.0/All/
EOF

pkgin update
pkgin upgrade
pkgin avail
pkgin list
pkgin search foo.*bar
pkgin install 'foo<5.0' bar baz
pkgin show-full-deps foo
pkgin show-rev-deps foo
pkgin requires foo
pkgin remove foo
pkgin autoremove
pkgin clean
pkgin export > my-packages
pkgin import my-packages
pkgin provides foo
pkgin pkg-content foo
+ +

Conclusion

NetBSD 9.1 aarch64 can use my Realtek RTL8152 Based USB Ethernet Adapter, it’s works very good. +But is can’t found WiFi Adapter in Raspberry Pi 3 Model B Plus Rev 1.3, it’s really disappointing.

+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/11/28/netbsd-9-aarch64-on-raspberry-pi-3b/raspberry_pi_pins.png b/2020/11/28/netbsd-9-aarch64-on-raspberry-pi-3b/raspberry_pi_pins.png new file mode 100644 index 00000000..24238cc2 Binary files /dev/null and b/2020/11/28/netbsd-9-aarch64-on-raspberry-pi-3b/raspberry_pi_pins.png differ diff --git a/2020/11/28/netbsd-9-aarch64-on-raspberry-pi-3b/rpi_machine_3bplus.pdf b/2020/11/28/netbsd-9-aarch64-on-raspberry-pi-3b/rpi_machine_3bplus.pdf new file mode 100644 index 00000000..cafa28e7 Binary files /dev/null and b/2020/11/28/netbsd-9-aarch64-on-raspberry-pi-3b/rpi_machine_3bplus.pdf differ diff --git a/2020/11/28/netbsd-9-armv6hf-on-raspberry-pi-3b/index.html b/2020/11/28/netbsd-9-armv6hf-on-raspberry-pi-3b/index.html new file mode 100644 index 00000000..09ed1ca6 --- /dev/null +++ b/2020/11/28/netbsd-9-armv6hf-on-raspberry-pi-3b/index.html @@ -0,0 +1,271 @@ + + + + + + + + + + + + NetBSD 9 armv6hf on Raspberry Pi 3B+ | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ NetBSD 9 armv6hf on Raspberry Pi 3B+ +

+ +

NetBSD 9 armv6hf on Raspberry Pi 3B+

Download NetBSD image

+
1
2
3
$ aria2c https://cdn.netbsd.org/pub/NetBSD/NetBSD-9.1/evbarm-earmv6hf/binary/gzimg/rpi.img.gz

$ aria2c https://nycdn.netbsd.org/pub/NetBSD-daily/netbsd-9/latest/evbarm-earmv6hf/binary/gzimg/rpi.img.gz
+ +

Write image to SDXC card

1
2
3
4
5
6
7
8
9
10
11
12
13
14
$ cat rpi.img.gz | gzip -cd | sudo dd of=/dev/sdb bs=4M oflag=sync status=progress; time sync
1201602560 bytes (1.2 GB, 1.1 GiB) copied, 70 s, 17.2 MB/s
0+18474 records in
0+18474 records out
1210712064 bytes (1.2 GB, 1.1 GiB) copied, 70.5264 s, 17.2 MB/s

real 0m0.008s
user 0m0.002s
sys 0m0.000s

$ vi /media/${USER}/NETBSD/cmdline.txt

root=ld0a
#root=ld0a console=fb
+ +

Booting Raspberry Pi

1
$ sudo minicom -b 115200 -8 -D /dev/ttyUSB0
+ +
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
# dmesg
[ 1.0000000] NetBSD/evbarm (fdt) booting ...
[ 1.0000000] [ Kernel symbol table missing! ]
[ 1.0000000] Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
[ 1.0000000] 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
[ 1.0000000] 2018, 2019, 2020 The NetBSD Foundation, Inc. All rights reserved.
[ 1.0000000] Copyright (c) 1982, 1986, 1989, 1991, 1993
[ 1.0000000] The Regents of the University of California. All rights reserved.

[ 1.0000000] NetBSD 9.1 (RPI2) #0: Sun Oct 18 19:24:30 UTC 2020
[ 1.0000000] mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/evbarm/compile/RPI2
[ 1.0000000] total memory = 948 MB
[ 1.0000000] avail memory = 930 MB
[ 1.0000000] running cgd selftest aes-xts-256 aes-xts-512 done
[ 1.0000000] armfdt0 (root)
[ 1.0000000] simplebus0 at armfdt0: Raspberry Pi 3 Model B Plus Rev 1.3
[ 1.0000000] simplebus1 at simplebus0
[ 1.0000000] simplebus2 at simplebus0
[ 1.0000000] cpus0 at simplebus0
[ 1.0000000] simplebus3 at simplebus0
[ 1.0000000] cpu0 at cpus0: 600 MHz Cortex-A53 r0p4 (Cortex V8A core)
[ 1.0000000] cpu0: DC enabled IC enabled WB enabled EABT branch prediction enabled
[ 1.0000000] cpu0: 32KB/64B 2-way L1 VIPT Instruction cache
[ 1.0000000] cpu0: 32KB/64B 4-way write-back-locking-C L1 PIPT Data cache
[ 1.0000000] cpu0: 512KB/64B 16-way write-through L2 PIPT Unified cache
[ 1.0000000] vfp0 at cpu0: NEON MPE (VFP 3.0+), rounding, NaN propagation, denormals
[ 1.0000000] cpu1 at cpus0
[ 1.0000000] cpu2 at cpus0
[ 1.0000000] cpu3 at cpus0
[ 1.0000000] fclock0 at simplebus2: 19200000 Hz fixed clock (osc)
[ 1.0000000] simplebus4 at simplebus1
[ 1.0000000] fclock1 at simplebus2: 480000000 Hz fixed clock (otg)
[ 1.0000000] bcmicu0 at simplebus1
[ 1.0000000] bcmicu1 at simplebus1: Multiprocessor
[ 1.0000000] bcmcprman0 at simplebus1: BCM283x Clock Controller
[ 1.0000000] gtmr0 at simplebus0: Generic Timer
[ 1.0000000] gtmr0: interrupting on local_intc irq 3
[ 1.0000000] armgtmr0 at gtmr0: Generic Timer (19200 kHz, virtual)
[ 1.0000030] bcmaux0 at simplebus1
[ 1.0000030] /soc/thermal@7e212000 at simplebus1 not configured
[ 1.0000030] /soc/dsi@7e209000 at simplebus1 not configured
[ 1.0000030] bcmgpio0 at simplebus1: GPIO controller
[ 1.0000030] bcmgpio0: pins 0..31 interrupting on icu irq 177
[ 1.0000030] bcmgpio0: pins 32..54 interrupting on icu irq 178
[ 1.0000030] gpio0 at bcmgpio0: 54 pins
[ 1.0000030] /soc/firmware/gpio at simplebus4 not configured
[ 1.0000030] bcmdmac0 at simplebus1: DMA0 DMA2 DMA4 DMA5 DMA8 DMA9 DMA10
[ 1.0000030] /soc/power at simplebus1 not configured
[ 1.0000030] /wifi-pwrseq at simplebus0 not configured
[ 1.0000030] bsciic0 at simplebus1: Broadcom Serial Controller
[ 1.0000030] iic0 at bsciic0: I2C bus
[ 1.0000030] /phy at simplebus0 not configured
[ 1.0000030] bcmpmwdog0 at simplebus1: Power management, Reset and Watchdog controller
[ 1.0000030] bcmmbox0 at simplebus1: VC mailbox
[ 1.0000030] bcmmbox0: interrupting on icu irq 193
[ 1.0000030] vcmbox0 at bcmmbox0
[ 1.0000030] plcom0 at simplebus1: ARM PL011 UART
[ 1.0000030] plcom0: txfifo disabled
[ 1.0000030] plcom0: interrupting on icu irq 185
[ 1.0000030] bcmsdhost0 at simplebus1: SD HOST controller
[ 1.0000030] bcmsdhost0: interrupting on icu irq 184
[ 1.0000030] bsciic1 at simplebus1: Broadcom Serial Controller
[ 1.0000030] iic1 at bsciic1: I2C bus
[ 1.0000030] com0 at simplebus1: BCM AUX UART, working fifo
[ 1.0000030] com0: console
[ 1.0000030] com0: interrupting on icu irq 157
[ 1.0000030] /soc/pwm@7e20c000 at simplebus1 not configured
[ 1.0000030] sdhc0 at simplebus1: SDHC controller
[ 1.0000030] sdhc0: interrupting on icu irq 190
[ 1.0000030] bsciic2 at simplebus1: Broadcom Serial Controller
[ 1.0000030] iic2 at bsciic2: I2C bus
[ 1.0000030] /soc/vec@7e806000 at simplebus1 not configured
[ 1.0000030] /soc/hdmi@7e902000 at simplebus1 not configured
[ 1.0000030] dwctwo0 at simplebus1: USB controller
[ 1.0000030] dwctwo0: interrupting on icu irq 137
[ 1.0000030] /soc/gpu at simplebus1 not configured
[ 1.0000030] genfb0 at simplebus1
[ 1.0000030] wsdisplay0 at genfb0 kbdmux 1
[ 1.0000030] vchiq0 at simplebus1: BCM2835 VCHIQ
[ 1.0000030] /arm-pmu at simplebus0 not configured
[ 1.0000030] gpioleds0 at simplebus0: ACT
[ 1.0000030] /soc/timer@7e003000 at simplebus1 not configured
[ 1.0000030] /soc/txp@7e004000 at simplebus1 not configured
[ 1.0000030] bcmrng0 at simplebus1: RNG
[ 1.0000030] cpu3: 600 MHz Cortex-A53 r0p4 (Cortex V8A core)
[ 1.0000030] cpu3: DC enabled IC enabled WB enabled EABT branch prediction enabled
[ 1.3750171] cpu3: 32KB/64B 2-way L1 VIPT Instruction cache
[ 1.3750171] cpu3: 32KB/64B 4-way write-back-locking-C L1 PIPT Data cache
[ 1.3850020] cpu3: 512KB/64B 16-way write-through L2 PIPT Unified cache
[ 1.3950038] vfp3 at cpu3: NEON MPE (VFP 3.0+), rounding, NaN propagation, denormals
[ 1.3950038] cpu1: 600 MHz Cortex-A53 r0p4 (Cortex V8A core)
[ 1.4050040] cpu1: DC enabled IC enabled WB enabled EABT branch prediction enabled
[ 1.4150064] cpu1: 32KB/64B 2-way L1 VIPT Instruction cache
[ 1.4150064] cpu1: 32KB/64B 4-way write-back-locking-C L1 PIPT Data cache
[ 1.4250063] cpu1: 512KB/64B 16-way write-through L2 PIPT Unified cache
[ 1.4350083] vfp1 at cpu1: NEON MPE (VFP 3.0+), rounding, NaN propagation, denormals
[ 1.4350083] cpu2: 600 MHz Cortex-A53 r0p4 (Cortex V8A core)
[ 1.4450082] cpu2: DC enabled IC enabled WB enabled EABT branch prediction enabled
[ 1.4550094] cpu2: 32KB/64B 2-way L1 VIPT Instruction cache
[ 1.4550094] cpu2: 32KB/64B 4-way write-back-locking-C L1 PIPT Data cache
[ 1.4650097] cpu2: 512KB/64B 16-way write-through L2 PIPT Unified cache
[ 1.4750113] vfp2 at cpu2: NEON MPE (VFP 3.0+), rounding, NaN propagation, denormals
[ 1.5650203] sdmmc0 at bcmsdhost0
[ 1.5650203] sdhc0: SDHC 3.0, rev 153, platform DMA, 200000 kHz, HS 3.3V, re-tuning mode 1, 1024 byte blocks
[ 1.5752904] sdmmc1 at sdhc0 slot 0
[ 1.5752904] usb0 at dwctwo0: USB revision 2.0
[ 1.6052945] uhub0 at usb0: NetBSD (0000) DWC2 root hub (0000), class 9/0, rev 2.00/1.00, addr 1
[ 1.6853009] sdmmc0: direct I/O error 5, r=6 p=0xbafd9f2c write
[ 1.7053052] sdmmc0: SD card status: 4-bit, C10, U1, V10, A1
[ 1.7053052] ld0 at sdmmc0: <0x27:0x5048:SD64G:0x60:0xda7f8e63:0x14a>
[ 1.7153056] ld0: 59616 MB, 7599 cyl, 255 head, 63 sec, 512 bytes/sect x 122093568 sectors
[ 1.7253063] ld0: 4-bit width, High-Speed/SDR25, 50.000 MHz
[ 1.7853115] sdmmc1: 4-bit width, 50.000 MHz
[ 1.7953121] sdmmc1: MAX_BLK_SIZE1 = 64
[ 1.7953121] sdmmc1: MAX_BLK_SIZE2 = 512
[ 1.7953121] sdmmc1: MAX_BLK_SIZE3 = 512
[ 1.8053134] sdmmc1: SDIO function
[ 1.8053134] (manufacturer 0x2d0, product 0xa9a6) at sdmmc1 function 1 not configured
[ 1.8153140] (manufacturer 0x2d0, product 0xa9a6) at sdmmc1 function 2 not configured
[ 1.8253161] (manufacturer 0x2d0, product 0xa9a6, standard function interface code 0x2) at sdmmc1 function 3 not configured
[ 3.4454558] uhub1 at uhub0 port 1: vendor 0424 (0x424) product 2514 (0x2514), class 9/0, rev 2.00/b.b3, addr 2
[ 3.4554575] uhub1: multiple transaction translators
[ 4.7656232] uhub2 at uhub1 port 1: vendor 0424 (0x424) product 2514 (0x2514), class 9/0, rev 2.00/b.b3, addr 3
[ 4.7756250] uhub2: multiple transaction translators
[ 5.1156698] uhub0: illegal enable change, port 1
[ 5.1256716] WARNING: 1 error while detecting hardware; check system log.
[ 5.1356726] boot device: ld0
[ 5.1356726] root on ld0a dumps on ld0b
[ 5.1456740] root file system type: ffs
[ 5.1556756] kern.module.path=/stand/evbarm/9.1/modules
[ 5.1556756] vchiq0: interrupting on icu irq 194
[ 5.1656772] vcaudio0 at vchiq0: auds
[ 5.1656772] WARNING: no TOD clock present
[ 5.1656772] WARNING: using filesystem time
[ 5.1789637] WARNING: CHECK AND RESET THE DATE!
[ 5.5657304] audio0 at vcaudio0: playback, capture, half duplex, independent
[ 5.5757316] audio0: slinear_le:16 -> slinear_le:16 2ch 48000Hz, blk 7680 bytes (40ms) for playback
[ 5.5857326] audio0: slinear_le:16 2ch 48000Hz, blk 7680 bytes (40ms) for recording
[ 5.5857326] spkr0 at audio0: PC Speaker (synthesized)
[ 5.5957336] wsbell at spkr0 not configured
Mon Oct 19 02:33:16 UTC 2020
Starting root file system check:
/dev/rld0a: file system is clean; not checking
Growing ld0 MBR partition #1 (1058MB -> 59520MB)
Growing ld0 disklabel (1154MB -> 59616MB)
Resizing /
[ 6.5258714] mue0 at uhub2 port 1 | 0%
[ 6.5358740] mue0: SMSC (0x424) LAN7800 USB 3.1 gigabit ethernet device (0x7800), rev 2.10/3.00, addr 4
[ 6.8259007] mue0: LAN7800 id 0x7800 rev 0x2
[ 6.8359016] ukphy0 at mue0 phy 1: SMSC LAN8742 10/100 media interface (OUI 0x00800f, model 0x0013), rev. 2
[ 6.8584752] ukphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 1000baseT-FDX, auto
[ 6.8671794] mue0: Ethernet address b8:27:eb:66:13:38
reboot: rebooted by root
[ 184.4840826] rebootin[ 1.0000000] NetBSD/evbarm (fdt) booting ...
[ 1.0000000] [ Kernel symbol table missing! ]
[ 1.0000000] Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
[ 1.0000000] 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
[ 1.0000000] 2018, 2019, 2020 The NetBSD Foundation, Inc. All rights reserved.
[ 1.0000000] Copyright (c) 1982, 1986, 1989, 1991, 1993
[ 1.0000000] The Regents of the University of California. All rights reserved.

[ 1.0000000] NetBSD 9.1 (RPI2) #0: Sun Oct 18 19:24:30 UTC 2020
[ 1.0000000] mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/evbarm/compile/RPI2
[ 1.0000000] total memory = 948 MB
[ 1.0000000] avail memory = 930 MB
[ 1.0000000] running cgd selftest aes-xts-256 aes-xts-512 done
[ 1.0000000] armfdt0 (root)
[ 1.0000000] simplebus0 at armfdt0: Raspberry Pi 3 Model B Plus Rev 1.3
[ 1.0000000] simplebus1 at simplebus0
[ 1.0000000] simplebus2 at simplebus0
[ 1.0000000] fclock0 at simplebus2: 19200000 Hz fixed clock (osc)
[ 1.0000000] simplebus3 at simplebus1
[ 1.0000000] fclock1 at simplebus2: 480000000 Hz fixed clock (otg)
[ 1.0000000] cpus0 at simplebus0
[ 1.0000000] simplebus4 at simplebus0
[ 1.0000000] cpu0 at cpus0: 600 MHz Cortex-A53 r0p4 (Cortex V8A core)
[ 1.0000000] cpu0: DC enabled IC enabled WB enabled EABT branch prediction enabled
[ 1.0000000] cpu0: 32KB/64B 2-way L1 VIPT Instruction cache
[ 1.0000000] cpu0: 32KB/64B 4-way write-back-locking-C L1 PIPT Data cache
[ 1.0000000] cpu0: 512KB/64B 16-way write-through L2 PIPT Unified cache
[ 1.0000000] vfp0 at cpu0: NEON MPE (VFP 3.0+), rounding, NaN propagation, denormals
[ 1.0000000] cpu1 at cpus0
[ 1.0000000] cpu2 at cpus0
[ 1.0000000] cpu3 at cpus0
[ 1.0000000] bcmicu0 at simplebus1
[ 1.0000000] bcmicu1 at simplebus1: Multiprocessor
[ 1.0000000] bcmcprman0 at simplebus1: BCM283x Clock Controller
[ 1.0000000] gtmr0 at simplebus0: Generic Timer
[ 1.0000000] gtmr0: interrupting on local_intc irq 3
[ 1.0000000] armgtmr0 at gtmr0: Generic Timer (19200 kHz, virtual)
[ 1.0000030] bcmaux0 at simplebus1
[ 1.0000030] /soc/thermal@7e212000 at simplebus1 not configured
[ 1.0000030] /soc/dsi@7e209000 at simplebus1 not configured
[ 1.0000030] bcmgpio0 at simplebus1: GPIO controller
[ 1.0000030] bcmgpio0: pins 0..31 interrupting on icu irq 177
[ 1.0000030] bcmgpio0: pins 32..54 interrupting on icu irq 178
[ 1.0000030] gpio0 at bcmgpio0: 54 pins
[ 1.0000030] /soc/firmware/gpio at simplebus3 not configured
[ 1.0000030] bcmdmac0 at simplebus1: DMA0 DMA2 DMA4 DMA5 DMA8 DMA9 DMA10
[ 1.0000030] /soc/power at simplebus1 not configured
[ 1.0000030] /wifi-pwrseq at simplebus0 not configured
[ 1.0000030] bsciic0 at simplebus1: Broadcom Serial Controller
[ 1.0000030] iic0 at bsciic0: I2C bus
[ 1.0000030] /phy at simplebus0 not configured
[ 1.0000030] bcmpmwdog0 at simplebus1: Power management, Reset and Watchdog controller
[ 1.0000030] bcmmbox0 at simplebus1: VC mailbox
[ 1.0000030] bcmmbox0: interrupting on icu irq 193
[ 1.0000030] vcmbox0 at bcmmbox0
[ 1.0000030] plcom0 at simplebus1: ARM PL011 UART
[ 1.0000030] plcom0: txfifo disabled
[ 1.0000030] plcom0: interrupting on icu irq 185
[ 1.0000030] bcmsdhost0 at simplebus1: SD HOST controller
[ 1.0000030] bcmsdhost0: interrupting on icu irq 184
[ 1.0000030] bsciic1 at simplebus1: Broadcom Serial Controller
[ 1.0000030] iic1 at bsciic1: I2C bus
[ 1.0000030] com0 at simplebus1: BCM AUX UART, working fifo
[ 1.0000030] com0: console
[ 1.0000030] com0: interrupting on icu irq 157
[ 1.0000030] /soc/pwm@7e20c000 at simplebus1 not configured
[ 1.0000030] sdhc0 at simplebus1: SDHC controller
[ 1.0000030] sdhc0: interrupting on icu irq 190
[ 1.0000030] bsciic2 at simplebus1: Broadcom Serial Controller
[ 1.0000030] iic2 at bsciic2: I2C bus
[ 1.0000030] /soc/vec@7e806000 at simplebus1 not configured
[ 1.0000030] /soc/hdmi@7e902000 at simplebus1 not configured
[ 1.0000030] dwctwo0 at simplebus1: USB controller
[ 1.0000030] dwctwo0: interrupting on icu irq 137
[ 1.0000030] /soc/gpu at simplebus1 not configured
[ 1.0000030] genfb0 at simplebus1
[ 1.0000030] wsdisplay0 at genfb0 kbdmux 1
[ 1.0000030] vchiq0 at simplebus1: BCM2835 VCHIQ
[ 1.0000030] /arm-pmu at simplebus0 not configured
[ 1.0000030] gpioleds0 at simplebus0: ACT
[ 1.0000030] /soc/timer@7e003000 at simplebus1 not configured
[ 1.0000030] /soc/txp@7e004000 at simplebus1 not configured
[ 1.0000030] bcmrng0 at simplebus1: RNG
[ 1.0000030] cpu3: 600 MHz Cortex-A53 r0p4 (Cortex V8A core)
[ 1.0000030] cpu3: DC enabled IC enabled WB enabled EABT branch prediction enabled
[ 1.3927887] cpu3: 32KB/64B 2-way L1 VIPT Instruction cache
[ 1.3927887] cpu3: 32KB/64B 4-way write-back-locking-C L1 PIPT Data cache
[ 1.4027731] cpu3: 512KB/64B 16-way write-through L2 PIPT Unified cache
[ 1.4127749] vfp3 at cpu3: NEON MPE (VFP 3.0+), rounding, NaN propagation, denormals
[ 1.4127749] cpu1: 600 MHz Cortex-A53 r0p4 (Cortex V8A core)
[ 1.4227752] cpu1: DC enabled IC enabled WB enabled EABT branch prediction enabled
[ 1.4327769] cpu1: 32KB/64B 2-way L1 VIPT Instruction cache
[ 1.4327769] cpu1: 32KB/64B 4-way write-back-locking-C L1 PIPT Data cache
[ 1.4427771] cpu1: 512KB/64B 16-way write-through L2 PIPT Unified cache
[ 1.4527794] vfp1 at cpu1: NEON MPE (VFP 3.0+), rounding, NaN propagation, denormals
[ 1.4527794] cpu2: 600 MHz Cortex-A53 r0p4 (Cortex V8A core)
[ 1.4627794] cpu2: DC enabled IC enabled WB enabled EABT branch prediction enabled
[ 1.4727806] cpu2: 32KB/64B 2-way L1 VIPT Instruction cache
[ 1.4727806] cpu2: 32KB/64B 4-way write-back-locking-C L1 PIPT Data cache
[ 1.4827808] cpu2: 512KB/64B 16-way write-through L2 PIPT Unified cache
[ 1.4927827] vfp2 at cpu2: NEON MPE (VFP 3.0+), rounding, NaN propagation, denormals
[ 1.5827928] sdmmc0 at bcmsdhost0
[ 1.5827928] sdhc0: SDHC 3.0, rev 153, platform DMA, 200000 kHz, HS 3.3V, re-tuning mode 1, 1024 byte blocks
[ 1.5934123] sdmmc1 at sdhc0 slot 0
[ 1.5934123] usb0 at dwctwo0: USB revision 2.0
[ 1.6234170] uhub0 at usb0: NetBSD (0000) DWC2 root hub (0000), class 9/0, rev 2.00/1.00, addr 1
[ 1.7034234] sdmmc0: direct I/O error 5, r=6 p=0xbafd9f2c write
[ 1.7234284] sdmmc0: SD card status: 4-bit, C10, U1, V10, A1
[ 1.7234284] ld0 at sdmmc0: <0x27:0x5048:SD64G:0x60:0xda7f8e63:0x14a>
[ 1.7351016] ld0: 59616 MB, 7599 cyl, 255 head, 63 sec, 512 bytes/sect x 122093568 sectors
[ 1.7434317] ld0: 4-bit width, High-Speed/SDR25, 50.000 MHz
[ 1.8034359] sdmmc1: 4-bit width, 50.000 MHz
[ 1.8134378] sdmmc1: MAX_BLK_SIZE1 = 64
[ 1.8134378] sdmmc1: MAX_BLK_SIZE2 = 512
[ 1.8134378] sdmmc1: MAX_BLK_SIZE3 = 512
[ 1.8234377] sdmmc1: SDIO function
[ 1.8234377] (manufacturer 0x2d0, product 0xa9a6) at sdmmc1 function 1 not configured
[ 1.8334395] (manufacturer 0x2d0, product 0xa9a6) at sdmmc1 function 2 not configured
[ 1.8434407] (manufacturer 0x2d0, product 0xa9a6, standard function interface code 0x2) at sdmmc1 function 3 not configured
[ 3.4635806] uhub1 at uhub0 port 1: vendor 0424 (0x424) product 2514 (0x2514), class 9/0, rev 2.00/b.b3, addr 2
[ 3.4735822] uhub1: multiple transaction translators
[ 4.7836926] uhub2 at uhub1 port 1: vendor 0424 (0x424) product 2514 (0x2514), class 9/0, rev 2.00/b.b3, addr 3
[ 4.7936943] uhub2: multiple transaction translators
[ 5.1337333] uhub0: illegal enable change, port 1
[ 5.1437353] WARNING: 1 error while detecting hardware; check system log.
[ 5.1537369] boot device: ld0
[ 5.1537369] root on ld0a dumps on ld0b
[ 5.1637379] root file system type: ffs
[ 5.1637379] kern.module.path=/stand/evbarm/9.1/modules
[ 5.1737393] vchiq0: interrupting on icu irq 194
[ 5.1837403] vcaudio0 at vchiq0: auds
[ 5.1837403] WARNING: no TOD clock present
[ 5.1837403] WARNING: using filesystem time
[ 5.1965977] WARNING: CHECK AND RESET THE DATE!
[ 5.6037960] audio0 at vcaudio0: playback, capture, half duplex, independent
[ 5.6037960] audio0: slinear_le:16 -> slinear_le:16 2ch 48000Hz, blk 7680 bytes (40ms) for playback
[ 5.6137977] audio0: slinear_le:16 2ch 48000Hz, blk 7680 bytes (40ms) for recording
[ 5.6237992] spkr0 at audio0: PC Speaker (synthesized)
[ 5.6237992] wsbell at spkr0 not configured
Mon Oct 19 02:33:17 UTC 2020
Starting root file system check:
/dev/rld0a: file system is clean; not checking
fdisk: Cannot determine the number of heads
[ 6.5539256] mue0 at uhub2 port 1
[ 6.5539256] mue0: SMSC (0x424) LAN7800 USB 3.1 gigabit ethernet device (0x7800), rev 2.10/3.00, addr 4
Not resizing /: already correct size
Starting file system checks:
/dev/rld0e: 23 files, 64640 free (16160 clusters)
[ 6.8439719] mue0: LAN7800 id 0x7800 rev 0x2
[ 6.8539714] ukphy0 at mue0 phy 1: SMSC LAN8742 10/100 media interface (OUI 0x00800f, model 0x0013), rev. 2
[ 6.8739766] ukphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 1000baseT-FDX, auto
[ 6.8739766] mue0: Ethernet address b8:27:eb:66:13:38
random_seed: /var/db/entropy-file: Not present
Setting tty flags.
Setting sysctl variables:
ddb.onpanic: 1 -> 0
Starting network.
Hostname: rpi
IPv6 mode: host
Configuring network interfaces:.
Adding interface aliases:.
Waiting for DAD to complete for statically configured addresses...
Starting dhcpcd.
Building databases: dev, utmp, utmpx, services.
wsconscfg: screen 1 is already configured
wsconscfg: screen 2 is already configured
wsconscfg: screen 3 is already configured
Starting syslogd.
Mounting all file systems...
Clearing temporary files.
Updating fontconfig cache:Oct 19 02:33:31 rpi dhcpcd[144]: mue0: failed to request information
Oct 19 02:33:31 rpi dhcpcd[144]: mue0: failed to request information
done.
Creating a.out runtime link editor directory cache.
Checking quotas: done.
Setting securelevel: kern.securelevel: 0 -> 1
Starting virecover.
Starting devpubd.
Starting local daemons:.
machdep.cpu.frequency.target: 600 -> 1400
Updating motd.
Starting ntpd.
ssh-keygen: 1024 SHA256:yt7uoKskNpzozjw9/kfjEfQZbQsyEEabfaqNKrePhyk root@rpi (DSA)
ssh-keygen: 521 SHA256:2V+CjCBNxilwoAs5FL7Ycg5Dj/KcDEr6r3ivXOvdX1Y root@rpi (ECDSA)
ssh-keygen: 256 SHA256:GDuRw/sMqVZvvDw9NvIM1t2T+uaU/hJYj07qlNQzprw root@rpi (ED25519)
ssh-keygen: 3072 SHA256:tckd8vNaKciCACT429kjQMWpcdKvwuf15JDwiPh3qh0 root@rpi (RSA)
Starting sshd.
postfix: rebuilding /etc/mail/aliases (missing /etc/mail/aliases.db)
Starting postfix.
Starting inetd.
Starting cron.
Mon Oct 19 02:34:28 UTC 2020

NetBSD/evbarm (rpi) (constty)

login:
+ +

Logging in to NetBSD

The default account for the images are root without password.

+

You must set the password and configure ssh to allow root login before you can log in remotely.

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
NetBSD/evbarm (rpi) (constty)

login: root
Oct 19 02:35:24 rpi login: ROOT LOGIN (root) on tty constty
Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
2018, 2019, 2020 The NetBSD Foundation, Inc. All rights reserved.
Copyright (c) 1982, 1986, 1989, 1991, 1993
The Regents of the University of California. All rights reserved.

NetBSD 9.1 (RPI2) #0: Sun Oct 18 19:24:30 UTC 2020

Welcome to NetBSD!

We recommend that you create a non-root account and use su(1) for root access.
rpi# passwd
Changing password for root.
New Password:
Retype New Password:
rpi#

# vi /etc/ssh/sshd_config
PermitRootLogin yes
#PermitRootLogin prohibit-password

# /etc/rc.d/sshd reload
Reloading sshd config files.
+ +

System characteristics

uname

1
2
3
4
5
# uname -snrmp
NetBSD rpi 9.1 evbarm earmv6hf

# uname -ap
NetBSD rpi 9.1 NetBSD 9.1 (RPI2) #0: Sun Oct 18 19:24:30 UTC 2020 mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/evbarm/compile/RPI2 evbarm earmv6hf
+ +

cpu

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# dmesg | grep cpu
[ 1.000000] cpus0 at simplebus0
[ 1.000000] cpu0 at cpus0: 600 MHz Cortex-A53 r0p4 (Cortex V8A core)
[ 1.000000] cpu0: DC enabled IC enabled WB enabled EABT branch prediction enabled
[ 1.000000] cpu0: 32KB/64B 2-way L1 VIPT Instruction cache
[ 1.000000] cpu0: 32KB/64B 4-way write-back-locking-C L1 PIPT Data cache
[ 1.000000] cpu0: 512KB/64B 16-way write-through L2 PIPT Unified cache
[ 1.000000] vfp0 at cpu0: NEON MPE (VFP 3.0+), rounding, NaN propagation, denormals
[ 1.000000] cpu1 at cpus0
[ 1.000000] cpu2 at cpus0
[ 1.000000] cpu3 at cpus0
[ 1.000003] cpu3: 600 MHz Cortex-A53 r0p4 (Cortex V8A core)
[ 1.000003] cpu3: DC enabled IC enabled WB enabled EABT branch prediction enabled
[ 1.392789] cpu3: 32KB/64B 2-way L1 VIPT Instruction cache
[ 1.392789] cpu3: 32KB/64B 4-way write-back-locking-C L1 PIPT Data cache
[ 1.402773] cpu3: 512KB/64B 16-way write-through L2 PIPT Unified cache
[ 1.412775] vfp3 at cpu3: NEON MPE (VFP 3.0+), rounding, NaN propagation, denormals
[ 1.412775] cpu1: 600 MHz Cortex-A53 r0p4 (Cortex V8A core)
[ 1.422775] cpu1: DC enabled IC enabled WB enabled EABT branch prediction enabled
[ 1.432777] cpu1: 32KB/64B 2-way L1 VIPT Instruction cache
[ 1.432777] cpu1: 32KB/64B 4-way write-back-locking-C L1 PIPT Data cache
[ 1.442777] cpu1: 512KB/64B 16-way write-through L2 PIPT Unified cache
[ 1.452779] vfp1 at cpu1: NEON MPE (VFP 3.0+), rounding, NaN propagation, denormals
[ 1.452779] cpu2: 600 MHz Cortex-A53 r0p4 (Cortex V8A core)
[ 1.462779] cpu2: DC enabled IC enabled WB enabled EABT branch prediction enabled
[ 1.472781] cpu2: 32KB/64B 2-way L1 VIPT Instruction cache
[ 1.472781] cpu2: 32KB/64B 4-way write-back-locking-C L1 PIPT Data cache
[ 1.482781] cpu2: 512KB/64B 16-way write-through L2 PIPT Unified cache
[ 1.492783] vfp2 at cpu2: NEON MPE (VFP 3.0+), rounding, NaN propagation, denormals
+ +

memory

1
2
3
4
5
6
7
8
9
10
11
# cat /proc/meminfo
total: used: free: shared: buffers: cached:
Mem: 976109568 254074880 722034688 0 197582848 228327424
Swap: 0 0 0
MemTotal: 953232 kB
MemFree: 705112 kB
MemShared: 0 kB
Buffers: 192952 kB
Cached: 222976 kB
SwapTotal: 0 kB
SwapFree: 0 kB
+ +

ure

Realtek RTL8152 Based USB Ethernet Adapter

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# dmesg | grep -i wifi
[ 1.000003] /wifi-pwrseq at simplebus0 not configured

# dmesg | grep ure0
[ 7.536410] ure0 at uhub3 port 1
[ 7.536410] ure0: Realtek (0xbda) USB 10/100 LAN (0x8152), rev 2.10/20.00, addr 5
[ 7.536410] ure0: RTL8152 ver 4c10
[ 7.606420] rlphy0 at ure0 phy 0: RTL8201E 10/100 media interface, rev. 2
[ 7.616422] ure0: Ethernet address 00:e0:4c:36:03:b4

# dmesg | grep mue0
[ 10.116755] mue0 at uhub2 port 1
[ 10.116755] mue0: vendor 0424 (0x424) product 7800 (0x7800), rev 2.10/3.00, addr 7
[ 10.406793] mue0: LAN7800 id 0x7800 rev 0x2
[ 10.406793] ukphy0 at mue0 phy 1: OUI 0x00800f, model 0x0013, rev. 2
[ 10.426797] mue0: Ethernet address b8:27:eb:66:13:38

+ +

sysctl

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
hw.disknames = ld0
hw.machine = evbarm
hw.machine_arch = earmv6hf
hw.model = raspberrypi,3-model-b-plus
hw.ncpu = 4
hw.ncpuonline = 4
hw.pagesize = 8192
hw.physmem = 994050048
hw.physmem64 = 994050048
hw.usermem = 980566016
hw.usermem64 = 980566016
kern.aio_listio_max = 512
kern.aio_max = 8192
kern.argmax = 262144
kern.clockrate: tick = 10000, tickadj = 40, hz = 100, profhz = 100, stathz = 100
kern.configname = RPI
kern.consdev = ttyE0
kern.dump_on_panic = 1
kern.expose_address = 1
kern.forkfsleep = 0
kern.fscale = 2048
kern.fsync = 1
kern.hardclock_ticks = 123376
kern.iov_max = 1024
kern.mbuf.mblowat = 16
kern.mbuf.mclbytes = 2048
kern.mbuf.mcllowat = 8
kern.mbuf.msize = 256
kern.mbuf.nmbclusters = 30336
kern.osrelease = 9.1
kern.osrevision = 901000000
kern.ostype = NetBSD
kern.timecounter.choice = clockinterrupt(q=0, f=100 Hz) armgtmr0(q=500, f=19200000 Hz) dummy(q=-1000000, f=1000000 Hz)
kern.timecounter.hardware = armgtmr0
kern.timecounter.timestepwarnings = 0
kern.version = NetBSD 9.1 (RPI2) #0: Sun Oct 18 19:24:30 UTC 2020
machdep.board_model = 0
machdep.board_revision = 10494163
machdep.booted_device = ld0
machdep.cpu.frequency.available = 600 1400
machdep.cpu.frequency.current = 1400
machdep.cpu.frequency.max = 1400
machdep.cpu.frequency.min = 600
machdep.cpu.frequency.target = 1400
machdep.cpu_arch = 8A
machdep.cpu_id = 1091555380
machdep.firmware_revision = 1536600398
machdep.fpu_id = 1090732084
machdep.fpu_present = 1
machdep.hwdiv_present = 1
machdep.neon_present = 1
machdep.powersave = 1
machdep.printfataltraps = 0
machdep.serial = 0x66661338
machdep.simd_present = 1
machdep.simdex_present = 1
machdep.synchprim_present = 32
+ +

mmc

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# dmesg | grep mmc
[ 1.582793] sdmmc0 at bcmsdhost0
[ 1.593412] sdmmc1 at sdhc0 slot 0
[ 1.703423] sdmmc0: direct I/O error 5, r=6 p=0xbafd9f2c write
[ 1.723428] sdmmc0: SD card status: 4-bit, C10, U1, V10, A1
[ 1.723428] ld0 at sdmmc0: <0x27:0x5048:SD64G:0x60:0xda7f8e63:0x14a>
[ 1.803436] sdmmc1: 4-bit width, 50.000 MHz
[ 1.813438] sdmmc1: MAX_BLK_SIZE1 = 64
[ 1.813438] sdmmc1: MAX_BLK_SIZE2 = 512
[ 1.813438] sdmmc1: MAX_BLK_SIZE3 = 512
[ 1.823438] sdmmc1: SDIO function
[ 1.823438] (manufacturer 0x2d0, product 0xa9a6) at sdmmc1 function 1 not configured
[ 1.833439] (manufacturer 0x2d0, product 0xa9a6) at sdmmc1 function 2 not configured
[ 1.843441] (manufacturer 0x2d0, product 0xa9a6, standard function interface code 0x2) at sdmmc1 function 3 not configured
+ +

mounts

1
2
3
4
5
6
7
# cat /proc/mounts
/dev/ld0a / ffs rw,noatime 0 0
/dev/ld0e /boot msdos rw 0 0
kernfs /kern kernfs rw 0 0
ptyfs /dev/pts ptyfs rw 0 0
procfs /proc proc rw 0 0
tmpfs /var/shm tmpfs rw 0 0
+ +

fdisk

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# fdisk /dev/rld0
Disk: /dev/rld0
NetBSD disklabel disk geometry:
cylinders: 7599, heads: 255, sectors/track: 63 (16065 sectors/cylinder)
total sectors: 122093568, bytes/sector: 512

BIOS disk geometry:
cylinders: 1023, heads: 255, sectors/track: 63 (16065 sectors/cylinder)
total sectors: 122093568

Partitions aligned to 2048 sector boundaries, offset 63

Partition table:
0: Primary DOS with 32 bit FAT - LBA (sysid 12)
start 32768, size 163840 (80 MB, Cyls 2/10/9-12/60/48), Active
1: NetBSD (sysid 169)
start 196608, size 121896960 (59520 MB, Cyls 12/60/49-7599/248/9)
PBR is not bootable: All bytes are identical (0x00)
2: <UNUSED>
3: <UNUSED>
First active partition: 0
Drive serial number: 0 (0x00000000)
+ +

disklabel

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# disklabel /dev/ld0
# /dev/ld0:
type: SCSI
disk: STORAGE DEVICE
label: fictitious
flags: removable
bytes/sector: 512
sectors/track: 32
tracks/cylinder: 64
sectors/cylinder: 2048
cylinders: 1154
total sectors: 122093568
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0 # microseconds
track-to-track seek: 0 # microseconds
drivedata: 0

8 partitions:
# size offset fstype [fsize bsize cpg/sgs]
a: 121896960 196608 4.2BSD 0 0 0 # (Cyl. 96 - 59615)
c: 122093568 0 unused 0 0 # (Cyl. 0 - 59615)
d: 122093568 0 unused 0 0 # (Cyl. 0 - 59615)
e: 163840 32768 MSDOS # (Cyl. 16 - 95)
+ +

List of processes after startup

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# ps -axdlww
UID PID PPID CPU PRI NI VSZ RSS WCHAN STAT TTY TIME COMMAND
0 0 0 0 0 0 0 8336 - OKl ? 0:29.35 [system]
0 1 0 23194 80 0 6048 1752 wait Is ? 0:00.02 - init
0 144 1 0 85 0 8360 2432 kqueue Ss ? 0:00.12 |-- dhcpcd: [master] [ip4] [ip6]
0 195 1 0 85 0 11624 2688 kqueue Ss ? 0:00.09 |-- /usr/sbin/syslogd -s
0 471 1 8819 83 0 6896 1088 devmon Is ? 0:00.00 |-- /sbin/devpubd
0 539 1 24259 80 0 17032 3280 select Is ? 0:00.01 |-- /usr/sbin/sshd
0 552 1 0 85 0 11144 13152 pause Ss ? 0:00.10 |-- /usr/sbin/ntpd -p /var/run/ntpd.pid -g
0 874 1 0 85 0 14296 3064 kqueue Is ? 0:00.04 |-- /usr/libexec/postfix/master -w
12 652 874 0 85 0 15280 4288 kqueue I ? 0:00.05 | |-- pickup -l -t unix -u
12 890 874 15626 82 0 15480 4328 kqueue I ? 0:00.04 | `-- qmgr -l -t unix -u
0 932 1 0 85 0 8680 1896 nanoslp Ss ? 0:00.01 |-- /usr/sbin/cron
0 953 1 16709 81 0 6280 1728 kqueue Is ? 0:00.00 |-- /usr/sbin/inetd -l
0 1010 1 696 85 0 13616 4864 wait Is tty00 0:00.10 `-- login
0 662 1010 0 85 0 8368 2296 wait S tty00 0:00.04 `-- -sh
0 830 662 0 43 0 5936 1664 - O+ tty00 0:00.00 `-- ps -axdlww
+ +

ifconfig

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# ifconfig -am
ure0: flags=0x8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
capabilities=3ff00<IP4CSUM_Rx,IP4CSUM_Tx,TCP4CSUM_Rx,TCP4CSUM_Tx>
capabilities=3ff00<UDP4CSUM_Rx,UDP4CSUM_Tx,TCP6CSUM_Rx,TCP6CSUM_Tx>
capabilities=3ff00<UDP6CSUM_Rx,UDP6CSUM_Tx>
enabled=0
ec_capabilities=1<VLAN_MTU>
ec_enabled=0
address: 00:e0:4c:36:03:b4
media: Ethernet autoselect (none)
status: no carrier
supported Ethernet media:
media 10baseT
media 10baseT mediaopt full-duplex
media 100baseTX
media 100baseTX mediaopt full-duplex
media autoselect
inet6 fe80::8b76:8c43:8609:1582%ure0/64 flags 0x8<DETACHED> scopeid 0x1
inet6 2409:8a55:8bc:dda0:364e:fd36:9aea:b84b/64 flags 0x8<DETACHED>
inet 192.168.1.10/24 broadcast 192.168.1.255 flags 0x4<DETACHED>
mue0: flags=0x8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
capabilities=7ff80<TSO4,IP4CSUM_Rx,IP4CSUM_Tx,TCP4CSUM_Rx>
capabilities=7ff80<TCP4CSUM_Tx,UDP4CSUM_Rx,UDP4CSUM_Tx,TCP6CSUM_Rx>
capabilities=7ff80<TCP6CSUM_Tx,UDP6CSUM_Rx,UDP6CSUM_Tx,TSO6>
enabled=0
ec_capabilities=1<VLAN_MTU>
ec_enabled=0
address: b8:27:eb:66:13:38
media: Ethernet autoselect (100baseTX full-duplex)
status: active
supported Ethernet media:
media none
media 10baseT
media 10baseT mediaopt full-duplex
media 100baseTX
media 100baseTX mediaopt full-duplex
media 1000baseT
media 1000baseT mediaopt full-duplex
media autoselect
inet6 fe80::c8b7:f665:5170:7094%mue0/64 flags 0x0 scopeid 0x2
inet6 2409:8a55:8bc:dda0:e09b:1f2d:3b05:9cb3/64 flags 0x0
inet 192.168.1.5/24 broadcast 192.168.1.255 flags 0x0
lo0: flags=0x8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 33176
inet6 ::1/128 flags 0x20<NODAD>
inet6 fe80::1%lo0/64 flags 0x0 scopeid 0x3
inet 127.0.0.1/8 flags 0x0
+ +

Compiler

1
2
3
4
5
6
7
8
9
10
11
# ld -v
GNU ld (NetBSD Binutils nb1) 2.31.1

# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/lto-wrapper
Target: armv6--netbsdelf-eabihf
Configured with: /usr/src/tools/gcc/../../external/gpl3/gcc/dist/configure --target=armv6--netbsdelf-eabihf --enable-long-long --enable-threads --with-bugurl=http://www.NetBSD.org/Misc/send-pr.html --with-pkgversion='NetBSD nb4 20200810' --with-system-zlib --without-isl --enable-__cxa_atexit --enable-libstdcxx-time=rt --enable-libstdcxx-threads --with-diagnostics-color=auto-if-env --with-default-libstdcxx-abi=new --with-mpc-lib=/var/obj/mknative/evbarm-earmv6hf/usr/src/external/lgpl3/mpc/lib/libmpc --with-mpfr-lib=/var/obj/mknative/evbarm-earmv6hf/usr/src/external/lgpl3/mpfr/lib/libmpfr --with-gmp-lib=/var/obj/mknative/evbarm-earmv6hf/usr/src/external/lgpl3/gmp/lib/libgmp --with-mpc-include=/usr/src/external/lgpl3/mpc/dist/src --with-mpfr-include=/usr/src/external/lgpl3/mpfr/dist/src --with-gmp-include=/usr/src/external/lgpl3/gmp/lib/libgmp/arch/arm --enable-tls --enable-initfini-array --disable-multilib --disable-libstdcxx-pch --build=armv6--netbsdelf-eabihf --host=armv6--netbsdelf-eabihf --with-sysroot=/var/obj/mknative/evbarm-earmv6hf/usr/src/destdir.evbarm
Thread model: posix
gcc version 7.5.0 (nb4 20200810)
+ +

NetBSD Packages Collection

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
export PKG_PATH="http://cdn.NetBSD.org/pub/pkgsrc/packages/$(uname -s)/$(uname -m)/$(uname -r | cut -f '1 2' -d.)/All/"
export PKG_PATH="http://cdn.netbsd.org/pub/pkgsrc/packages/NetBSD/earmv6hf/9.1/All/;http://cdn.netbsd.org/pub/pkgsrc/packages/NetBSD/earmv6hf/9.0/All/"

pkg_admin fetch-pkg-vulnerabilities

pkg_add -uv tmux bash pkgin avahi clang python38

pkg_info tmux

pkg_delete -r jpeg

cat << EOF > /usr/pkg/etc/pkgin/repositories.conf
#
# Pkgin repositories list
#
# Simply add repositories URIs one below the other
#
# WARNING: order matters, duplicates will not be added, if two
# repositories hold the same package, it will be fetched from
# the first one listed in this file.
#

http://cdn.netbsd.org/pub/pkgsrc/packages/NetBSD/earmv6hf/9.1/All/
http://cdn.netbsd.org/pub/pkgsrc/packages/NetBSD/earmv6hf/9.0/All/
EOF

pkgin update
pkgin upgrade
pkgin avail
pkgin list
pkgin search foo.*bar
pkgin install 'foo<5.0' bar baz
pkgin show-full-deps foo
pkgin show-rev-deps foo
pkgin requires foo
pkgin remove foo
pkgin autoremove
pkgin clean
pkgin export > my-packages
pkgin import my-packages
pkgin provides foo
pkgin pkg-content foo
+ +

Conclusion

NetBSD 9.1 earmv6hf can use my Realtek RTL8152 Based USB Ethernet Adapter, it’s works very good. +But is can’t found WiFi Adapter in Raspberry Pi 3 Model B Plus Rev 1.3, it’s really disappointing.

+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/11/28/netbsd-9-armv7hf-on-raspberry-pi-3b/index.html b/2020/11/28/netbsd-9-armv7hf-on-raspberry-pi-3b/index.html new file mode 100644 index 00000000..328ceea1 --- /dev/null +++ b/2020/11/28/netbsd-9-armv7hf-on-raspberry-pi-3b/index.html @@ -0,0 +1,271 @@ + + + + + + + + + + + + NetBSD 9 armv7hf on Raspberry Pi 3B+ | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ NetBSD 9 armv7hf on Raspberry Pi 3B+ +

+ +

NetBSD 9 armv7hf on Raspberry Pi 3B+

Download NetBSD image

+
1
2
3
$ aria2c https://cdn.netbsd.org/pub/NetBSD/NetBSD-9.1/evbarm-earmv7hf/binary/gzimg/armv7.img.gz

$ aria2c https://nycdn.netbsd.org/pub/NetBSD-daily/netbsd-9/latest/evbarm-earmv7hf/binary/gzimg/rpi.img.gz
+ +

Write image to SDXC card

1
2
3
4
5
6
7
8
9
$ cat armv7.img.gz | gzip -cd | sudo dd of=/dev/sdb bs=4M oflag=sync status=progress; time sync
1210023936 bytes (1.2 GB, 1.1 GiB) copied, 70 s, 17.3 MB/s
0+18614 records in
0+18614 records out
1219756032 bytes (1.2 GB, 1.1 GiB) copied, 70.581 s, 17.3 MB/s

real 0m0.015s
user 0m0.002s
sys 0m0.000s
+ +

Booting Raspberry Pi

1
$ sudo minicom -b 115200 -8 -D /dev/ttyUSB0
+ +
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
armv7# dmesg
[ 1.0000000] NetBSD/evbarm (fdt) booting ...
[ 1.0000000] [ Kernel symbol table missing! ]
[ 1.0000000] Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
[ 1.0000000] 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
[ 1.0000000] 2018, 2019, 2020 The NetBSD Foundation, Inc. All rights reserved.
[ 1.0000000] Copyright (c) 1982, 1986, 1989, 1991, 1993
[ 1.0000000] The Regents of the University of California. All rights reserved.

[ 1.0000000] NetBSD 9.1 (GENERIC) #0: Sun Oct 18 19:24:30 UTC 2020
[ 1.0000000] mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/evbarm/compile/GENERIC
[ 1.0000000] total memory = 948 MB
[ 1.0000000] avail memory = 928 MB
[ 1.0000000] running cgd selftest aes-xts-256 aes-xts-512 done
[ 1.0000000] armfdt0 (root)
[ 1.0000000] simplebus0 at armfdt0: Raspberry Pi 3 Model B Plus Rev 1.3
[ 1.0000000] simplebus1 at simplebus0
[ 1.0000000] simplebus2 at simplebus0
[ 1.0000000] cpus0 at simplebus0
[ 1.0000000] simplebus3 at simplebus0
[ 1.0000000] cpu0 at cpus0: 600 MHz Cortex-A53 r0p4 (Cortex V8A core)
[ 1.0000000] cpu0: DC enabled IC enabled WB enabled EABT branch prediction enabled
[ 1.0000000] cpu0: 32KB/64B 2-way L1 VIPT Instruction cache
[ 1.0000000] cpu0: 32KB/64B 4-way write-back-locking-C L1 PIPT Data cache
[ 1.0000000] cpu0: 512KB/64B 16-way write-through L2 PIPT Unified cache
[ 1.0000000] vfp0 at cpu0: NEON MPE (VFP 3.0+), rounding, NaN propagation, denormals
[ 1.0000000] cpu1 at cpus0
[ 1.0000000] cpu2 at cpus0
[ 1.0000000] cpu3 at cpus0
[ 1.0000000] simplebus4 at simplebus1
[ 1.0000000] bcmicu0 at simplebus1
[ 1.0000000] bcmicu1 at simplebus1: Multiprocessor
[ 1.0000000] bcmcprman0 at simplebus1: BCM283x Clock Controller
[ 1.0000000] fclock0 at simplebus2: 19200000 Hz fixed clock (osc)
[ 1.0000000] bcmaux0 at simplebus1
[ 1.0000000] fclock1 at simplebus2: 480000000 Hz fixed clock (otg)
[ 1.0000000] gtmr0 at simplebus0: Generic Timer
[ 1.0000000] gtmr0: interrupting on local_intc irq 3
[ 1.0000000] armgtmr0 at gtmr0: Generic Timer (19200 kHz, virtual)
[ 1.0000030] plcom0 at simplebus1: ARM PL011 UART
[ 1.0000030] plcom0: txfifo disabled
[ 1.0000030] plcom0: interrupting on icu irq 185
[ 1.0000030] com0 at simplebus1: BCM AUX UART, working fifo
[ 1.0000030] com0: console
[ 1.0000030] com0: interrupting on icu irq 157
[ 1.0000030] usbnopphy0 at simplebus0: USB PHY
[ 1.0000030] /soc/thermal@7e212000 at simplebus1 not configured
[ 1.0000030] /soc/dsi@7e209000 at simplebus1 not configured
[ 1.0000030] bcmgpio0 at simplebus1: GPIO controller
[ 1.0000030] bcmgpio0: pins 0..31 interrupting on icu irq 177
[ 1.0000030] bcmgpio0: pins 32..54 interrupting on icu irq 178
[ 1.0000030] gpio0 at bcmgpio0: 54 pins
[ 1.0000030] /soc/firmware/gpio at simplebus4 not configured
[ 1.0000030] bcmdmac0 at simplebus1: DMA0 DMA2 DMA4 DMA5 DMA8 DMA9 DMA10
[ 1.0000030] /soc/power at simplebus1 not configured
[ 1.0000030] mmcpwrseq0 at simplebus0: couldn't get reset GPIOs
[ 1.0000030] bsciic0 at simplebus1: Broadcom Serial Controller
[ 1.0000030] iic0 at bsciic0: I2C bus
[ 1.0000030] bcmpmwdog0 at simplebus1: Power management, Reset and Watchdog controller
[ 1.0000030] bcmmbox0 at simplebus1: VC mailbox
[ 1.0000030] bcmmbox0: interrupting on icu irq 193
[ 1.0000030] vcmbox0 at bcmmbox0
[ 1.0000030] bcmsdhost0 at simplebus1: SD HOST controller
[ 1.0000030] bcmsdhost0: interrupting on icu irq 184
[ 1.0000030] bsciic1 at simplebus1: Broadcom Serial Controller
[ 1.0000030] iic1 at bsciic1: I2C bus
[ 1.0000030] /soc/pwm@7e20c000 at simplebus1 not configured
[ 1.0000030] sdhc0 at simplebus1: SDHC controller
[ 1.0000030] sdhc0: interrupting on icu irq 190
[ 1.0000030] bsciic2 at simplebus1: Broadcom Serial Controller
[ 1.0000030] iic2 at bsciic2: I2C bus
[ 1.0000030] /soc/vec@7e806000 at simplebus1 not configured
[ 1.0000030] /soc/hdmi@7e902000 at simplebus1 not configured
[ 1.0000030] dwctwo0 at simplebus1: USB controller
[ 1.0000030] dwctwo0: interrupting on icu irq 137
[ 1.0000030] /soc/gpu at simplebus1 not configured
[ 1.0000030] genfb0 at simplebus1: switching to framebuffer console
[ 1.0000030] wsdisplay0 at genfb0 kbdmux 1: console (default, vt100 emulation)
[ 1.0000030] vchiq0 at simplebus1: BCM2835 VCHIQ
[ 1.0000030] armpmu0 at simplebus0: Performance Monitor Unit
[ 1.0000030] gpioleds0 at simplebus0: ACT
[ 1.0000030] /soc/timer@7e003000 at simplebus1 not configured
[ 1.0000030] /soc/txp@7e004000 at simplebus1 not configured
[ 1.0000030] bcmrng0 at simplebus1: RNG
[ 1.0000030] cpu3: 600 MHz Cortex-A53 r0p4 (Cortex V8A core)
[ 1.6565570] cpu3: DC enabled IC enabled WB enabled EABT branch prediction enabled
[ 1.6965622] cpu3: 32KB/64B 2-way L1 VIPT Instruction cache
[ 1.7265639] cpu3: 32KB/64B 4-way write-back-locking-C L1 PIPT Data cache
[ 1.7665691] cpu3: 512KB/64B 16-way write-through L2 PIPT Unified cache
[ 1.7965720] vfp3 at cpu3: NEON MPE (VFP 3.0+), rounding, NaN propagation, denormals
[ 1.8365777] cpu2: 600 MHz Cortex-A53 r0p4 (Cortex V8A core)
[ 1.8665808] cpu2: DC enabled IC enabled WB enabled EABT branch prediction enabled
[ 1.9065852] cpu2: 32KB/64B 2-way L1 VIPT Instruction cache
[ 1.9465892] cpu2: 32KB/64B 4-way write-back-locking-C L1 PIPT Data cache
[ 1.9765938] cpu2: 512KB/64B 16-way write-through L2 PIPT Unified cache
[ 2.0165980] vfp2 at cpu2: NEON MPE (VFP 3.0+), rounding, NaN propagation, denormals
[ 2.0566027] cpu1: 600 MHz Cortex-A53 r0p4 (Cortex V8A core)
[ 2.0866051] cpu1: DC enabled IC enabled WB enabled EABT branch prediction enabled
[ 2.1266104] cpu1: 32KB/64B 2-way L1 VIPT Instruction cache
[ 2.1666146] cpu1: 32KB/64B 4-way write-back-locking-C L1 PIPT Data cache
[ 2.2066191] cpu1: 512KB/64B 16-way write-through L2 PIPT Unified cache
[ 2.2366239] vfp1 at cpu1: NEON MPE (VFP 3.0+), rounding, NaN propagation, denormals
[ 2.3966416] sdmmc0 at bcmsdhost0
[ 2.3966416] sdhc0: SDHC 3.0, rev 153, platform DMA, 200000 kHz, HS 3.3V, re-tuning mode 1, 1024 byte blocks
[ 2.4072849] sdmmc1 at sdhc0 slot 0
[ 2.4072849] usb0 at dwctwo0: USB revision 2.0
[ 2.4467208] armpmu0: interrupting on local_intc irq 9
[ 2.4567205] uhub0 at usb0: NetBSD (0000) DWC2 root hub (0000), class 9/0, rev 2.00/1.00, addr 1
[ 2.5367303] sdmmc0: direct I/O error 5, r=6 p=0xba649f2c write
[ 2.5767364] sdmmc0: SD card status: 4-bit, C10, U1, V10, A1
[ 2.5767364] ld0 at sdmmc0: <0x27:0x5048:SD64G:0x60:0xda7f8e63:0x14a>
[ 2.5882678] ld0: 59616 MB, 7599 cyl, 255 head, 63 sec, 512 bytes/sect x 122093568 sectors
[ 2.5967407] ld0: 4-bit width, High-Speed/SDR25, 50.000 MHz
[ 2.6767485] sdmmc1: 4-bit width, 50.000 MHz
[ 2.6767485] sdmmc1: MAX_BLK_SIZE1 = 64
[ 2.7067548] sdmmc1: MAX_BLK_SIZE2 = 512
[ 2.7067548] sdmmc1: MAX_BLK_SIZE3 = 512
[ 2.7174104] sdmmc1: SDIO function
[ 2.7174104] (manufacturer 0x2d0, product 0xa9a6) at sdmmc1 function 1 not configured
[ 2.7271037] (manufacturer 0x2d0, product 0xa9a6) at sdmmc1 function 2 not configured
[ 2.7271037] (manufacturer 0x2d0, product 0xa9a6, standard function interface code 0x2) at sdmmc1 function 3 not configured
[ 4.2772411] uhub1 at uhub0 port 1: vendor 0424 (0x424) product 2514 (0x2514), class 9/0, rev 2.00/b.b3, addr 2
[ 4.2772411] uhub1: multiple transaction translators
[ 5.5973567] uhub2 at uhub1 port 1: vendor 0424 (0x424) product 2514 (0x2514), class 9/0, rev 2.00/b.b3, addr 3
[ 5.5973567] uhub2: multiple transaction translators
[ 5.9673979] uhub0: illegal enable change, port 1
[ 5.9673979] WARNING: 2 errors while detecting hardware; check system log.
[ 5.9773999] boot device: ld0
[ 5.9773999] root on ld0a dumps on ld0b
[ 6.0074035] root file system type: ffs
[ 6.0174052] kern.module.path=/stand/evbarm/9.1/modules
[ 6.0274058] vchiq0: interrupting on icu irq 194
[ 6.0274058] vcaudio0 at vchiq0: auds
[ 6.0374075] WARNING: no TOD clock present
[ 6.0374075] WARNING: using filesystem time
[ 6.0481341] WARNING: CHECK AND RESET THE DATE!
[ 6.6974954] audio0 at vcaudio0: playback, capture, half duplex, independent
[ 6.7074971] audio0: slinear_le:16 -> slinear_le:16 2ch 48000Hz, blk 7680 bytes (40ms) for playback
[ 6.7174985] audio0: slinear_le:16 2ch 48000Hz, blk 7680 bytes (40ms) for recording
[ 6.7274995] spkr0 at audio0: PC Speaker (synthesized)
[ 6.7274995] wsbell at spkr0 not configured
Mon Oct 19 02:46:35 UTC 2020
Starting root file system check:
[ 7.3775938] mue0 at uhub2 port 1
[ 7.3775938] mue0: SMSC (0x424) LAN7800 USB 3.1 gigabit ethernet device (0x7800), rev 2.10/3.00, addr 4
/dev/rld0a: file system is clean; not checking
Growing ld0 MBR partition #1 (1067MB -> 59520MB)
Growing ld0 disklabel (1163MB -> 59616MB)
[ 7.6876371] mue0: LAN7800 id 0x7800 rev 0x2
Resizing /
[ 7.7176402] ukphy0 at mue0 phy 1: SMSC LAN8742 10/100 media interface (OUI 0x00800f, model 0x0013), rev. 2
[ 7.7276432] ukphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 1000baseT-FDX, auto
[ 7.7376431] mue0: Ethernet address b8:27:eb:66:13:38
reboot: rebooted by root
[ 186.3959532] rebooting...
[ 1.0000000] NetBSD/evbarm (fdt) booting ...
[ 1.0000000] [ Kernel symbol table missing! ]
[ 1.0000000] Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
[ 1.0000000] 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
[ 1.0000000] 2018, 2019, 2020 The NetBSD Foundation, Inc. All rights reserved.
[ 1.0000000] Copyright (c) 1982, 1986, 1989, 1991, 1993
[ 1.0000000] The Regents of the University of California. All rights reserved.

[ 1.0000000] NetBSD 9.1 (GENERIC) #0: Sun Oct 18 19:24:30 UTC 2020
[ 1.0000000] mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/evbarm/compile/GENERIC
[ 1.0000000] total memory = 948 MB
[ 1.0000000] avail memory = 928 MB
[ 1.0000000] running cgd selftest aes-xts-256 aes-xts-512 done
[ 1.0000000] armfdt0 (root)
[ 1.0000000] simplebus0 at armfdt0: Raspberry Pi 3 Model B Plus Rev 1.3
[ 1.0000000] simplebus1 at simplebus0
[ 1.0000000] simplebus2 at simplebus0
[ 1.0000000] simplebus3 at simplebus1
[ 1.0000000] cpus0 at simplebus0
[ 1.0000000] simplebus4 at simplebus0
[ 1.0000000] cpu0 at cpus0: 600 MHz Cortex-A53 r0p4 (Cortex V8A core)
[ 1.0000000] cpu0: DC enabled IC enabled WB enabled EABT branch prediction enabled
[ 1.0000000] cpu0: 32KB/64B 2-way L1 VIPT Instruction cache
[ 1.0000000] cpu0: 32KB/64B 4-way write-back-locking-C L1 PIPT Data cache
[ 1.0000000] cpu0: 512KB/64B 16-way write-through L2 PIPT Unified cache
[ 1.0000000] vfp0 at cpu0: NEON MPE (VFP 3.0+), rounding, NaN propagation, denormals
[ 1.0000000] cpu1 at cpus0
[ 1.0000000] cpu2 at cpus0
[ 1.0000000] cpu3 at cpus0
[ 1.0000000] bcmicu0 at simplebus1
[ 1.0000000] bcmicu1 at simplebus1: Multiprocessor
[ 1.0000000] bcmcprman0 at simplebus1: BCM283x Clock Controller
[ 1.0000000] fclock0 at simplebus2: 19200000 Hz fixed clock (osc)
[ 1.0000000] bcmaux0 at simplebus1
[ 1.0000000] fclock1 at simplebus2: 480000000 Hz fixed clock (otg)
[ 1.0000000] gtmr0 at simplebus0: Generic Timer
[ 1.0000000] gtmr0: interrupting on local_intc irq 3
[ 1.0000000] armgtmr0 at gtmr0: Generic Timer (19200 kHz, virtual)
[ 1.0000030] plcom0 at simplebus1: ARM PL011 UART
[ 1.0000030] plcom0: txfifo disabled
[ 1.0000030] plcom0: interrupting on icu irq 185
[ 1.0000030] com0 at simplebus1: BCM AUX UART, working fifo
[ 1.0000030] com0: console
[ 1.0000030] com0: interrupting on icu irq 157
[ 1.0000030] usbnopphy0 at simplebus0: USB PHY
[ 1.0000030] /soc/thermal@7e212000 at simplebus1 not configured
[ 1.0000030] /soc/dsi@7e209000 at simplebus1 not configured
[ 1.0000030] bcmgpio0 at simplebus1: GPIO controller
[ 1.0000030] bcmgpio0: pins 0..31 interrupting on icu irq 177
[ 1.0000030] bcmgpio0: pins 32..54 interrupting on icu irq 178
[ 1.0000030] gpio0 at bcmgpio0: 54 pins
[ 1.0000030] /soc/firmware/gpio at simplebus3 not configured
[ 1.0000030] bcmdmac0 at simplebus1: DMA0 DMA2 DMA4 DMA5 DMA8 DMA9 DMA10
[ 1.0000030] /soc/power at simplebus1 not configured
[ 1.0000030] mmcpwrseq0 at simplebus0: couldn't get reset GPIOs
[ 1.0000030] bsciic0 at simplebus1: Broadcom Serial Controller
[ 1.0000030] iic0 at bsciic0: I2C bus
[ 1.0000030] bcmpmwdog0 at simplebus1: Power management, Reset and Watchdog controller
[ 1.0000030] bcmmbox0 at simplebus1: VC mailbox
[ 1.0000030] bcmmbox0: interrupting on icu irq 193
[ 1.0000030] vcmbox0 at bcmmbox0
[ 1.0000030] bcmsdhost0 at simplebus1: SD HOST controller
[ 1.0000030] bcmsdhost0: interrupting on icu irq 184
[ 1.0000030] bsciic1 at simplebus1: Broadcom Serial Controller
[ 1.0000030] iic1 at bsciic1: I2C bus
[ 1.0000030] /soc/pwm@7e20c000 at simplebus1 not configured
[ 1.0000030] sdhc0 at simplebus1: SDHC controller
[ 1.0000030] sdhc0: interrupting on icu irq 190
[ 1.0000030] bsciic2 at simplebus1: Broadcom Serial Controller
[ 1.0000030] iic2 at bsciic2: I2C bus
[ 1.0000030] /soc/vec@7e806000 at simplebus1 not configured
[ 1.0000030] /soc/hdmi@7e902000 at simplebus1 not configured
[ 1.0000030] dwctwo0 at simplebus1: USB controller
[ 1.0000030] dwctwo0: interrupting on icu irq 137
[ 1.0000030] /soc/gpu at simplebus1 not configured
[ 1.0000030] genfb0 at simplebus1: switching to framebuffer console
[ 1.0000030] wsdisplay0 at genfb0 kbdmux 1: console (default, vt100 emulation)
[ 1.0000030] vchiq0 at simplebus1: BCM2835 VCHIQ
[ 1.0000030] armpmu0 at simplebus0: Performance Monitor Unit
[ 1.0000030] gpioleds0 at simplebus0: ACT
[ 1.0000030] /soc/timer@7e003000 at simplebus1 not configured
[ 1.0000030] /soc/txp@7e004000 at simplebus1 not configured
[ 1.0000030] bcmrng0 at simplebus1: RNG
[ 1.0000030] cpu3: 600 MHz Cortex-A53 r0p4 (Cortex V8A core)
[ 1.6869184] cpu3: DC enabled IC enabled WB enabled EABT branch prediction enabled
[ 1.7269250] cpu3: 32KB/64B 2-way L1 VIPT Instruction cache
[ 1.7569260] cpu3: 32KB/64B 4-way write-back-locking-C L1 PIPT Data cache
[ 1.7969313] cpu3: 512KB/64B 16-way write-through L2 PIPT Unified cache
[ 1.8269342] vfp3 at cpu3: NEON MPE (VFP 3.0+), rounding, NaN propagation, denormals
[ 1.8669401] cpu2: 600 MHz Cortex-A53 r0p4 (Cortex V8A core)
[ 1.8969428] cpu2: DC enabled IC enabled WB enabled EABT branch prediction enabled
[ 1.9369469] cpu2: 32KB/64B 2-way L1 VIPT Instruction cache
[ 1.9769531] cpu2: 32KB/64B 4-way write-back-locking-C L1 PIPT Data cache
[ 2.0069557] cpu2: 512KB/64B 16-way write-through L2 PIPT Unified cache
[ 2.0469601] vfp2 at cpu2: NEON MPE (VFP 3.0+), rounding, NaN propagation, denormals
[ 2.0869650] cpu1: 600 MHz Cortex-A53 r0p4 (Cortex V8A core)
[ 2.1169696] cpu1: DC enabled IC enabled WB enabled EABT branch prediction enabled
[ 2.1569736] cpu1: 32KB/64B 2-way L1 VIPT Instruction cache
[ 2.1969777] cpu1: 32KB/64B 4-way write-back-locking-C L1 PIPT Data cache
[ 2.2369832] cpu1: 512KB/64B 16-way write-through L2 PIPT Unified cache
[ 2.2669872] vfp1 at cpu1: NEON MPE (VFP 3.0+), rounding, NaN propagation, denormals
[ 2.4270045] sdmmc0 at bcmsdhost0
[ 2.4270045] sdhc0: SDHC 3.0, rev 153, platform DMA, 200000 kHz, HS 3.3V, re-tuning mode 1, 1024 byte blocks
[ 2.4376506] sdmmc1 at sdhc0 slot 0
[ 2.4376506] usb0 at dwctwo0: USB revision 2.0
[ 2.4770867] armpmu0: interrupting on local_intc irq 9
[ 2.4870872] uhub0 at usb0: NetBSD (0000) DWC2 root hub (0000), class 9/0, rev 2.00/1.00, addr 1
[ 2.5670959] sdmmc0: direct I/O error 5, r=6 p=0xba649f2c write
[ 2.6071029] sdmmc0: SD card status: 4-bit, C10, U1, V10, A1
[ 2.6171013] ld0 at sdmmc0: <0x27:0x5048:SD64G:0x60:0xda7f8e63:0x14a>
[ 2.6171013] ld0: 59616 MB, 7599 cyl, 255 head, 63 sec, 512 bytes/sect x 122093568 sectors
[ 2.6471071] ld0: 4-bit width, High-Speed/SDR25, 50.000 MHz
[ 2.7271151] sdmmc1: 4-bit width, 50.000 MHz
[ 2.7383915] sdmmc1: MAX_BLK_SIZE1 = 64
[ 2.7383915] sdmmc1: MAX_BLK_SIZE2 = 512
[ 2.7472047] sdmmc1: MAX_BLK_SIZE3 = 512
[ 2.7472047] sdmmc1: SDIO function
[ 2.7472047] (manufacturer 0x2d0, product 0xa9a6) at sdmmc1 function 1 not configured
[ 2.7772101] (manufacturer 0x2d0, product 0xa9a6) at sdmmc1 function 2 not configured
[ 2.7878890] (manufacturer 0x2d0, product 0xa9a6, standard function interface code 0x2) at sdmmc1 function 3 not configured
[ 4.3080208] uhub1 at uhub0 port 1: vendor 0424 (0x424) product 2514 (0x2514), class 9/0, rev 2.00/b.b3, addr 2
[ 4.3180228] uhub1: multiple transaction translators
[ 5.6281963] uhub2 at uhub1 port 1: vendor 0424 (0x424) product 2514 (0x2514), class 9/0, rev 2.00/b.b3, addr 3
[ 5.6381981] uhub2: multiple transaction translators
[ 5.9982456] uhub0: illegal enable change, port 1
[ 6.0082476] WARNING: 2 errors while detecting hardware; check system log.
[ 6.0082476] boot device: ld0
[ 6.0382519] root on ld0a dumps on ld0b
[ 6.0482528] root file system type: ffs
[ 6.0582542] kern.module.path=/stand/evbarm/9.1/modules
[ 6.0582542] vchiq0: interrupting on icu irq 194
[ 6.0682560] vcaudio0 at vchiq0: auds
[ 6.0682560] WARNING: no TOD clock present
[ 6.0682560] WARNING: using filesystem time
[ 6.0815215] WARNING: CHECK AND RESET THE DATE!
[ 6.8683619] audio0 at vcaudio0: playback, capture, half duplex, independent
[ 6.8791971] audio0: slinear_le:16 -> slinear_le:16 2ch 48000Hz, blk 7680 bytes (40ms) for playback
[ 6.8884522] audio0: slinear_le:16 2ch 48000Hz, blk 7680 bytes (40ms) for recording
[ 6.8884522] spkr0 at audio0: PC Speaker (synthesized)
[ 6.9184549] wsbell at spkr0 not configured
Mon Oct 19 02:46:37 UTC 2020
[ 7.4185125] mue0 at uhub2 port 1
[ 7.4185125] mue0: SMSC (0x424) LAN7800 USB 3.1 gigabit ethernet device (0x7800), rev 2.10/3.00, addr 4
Starting root file system check:
/dev/rld0a: file system is clean; not checking
fdisk: Cannot determine the number of heads
[ 7.7185551] mue0: LAN7800 id 0x7800 rev 0x2
[ 7.7285539] ukphy0 at mue0 phy 1: SMSC LAN8742 10/100 media interface (OUI 0x00800f, model 0x0013), rev. 2
[ 7.7585544] ukphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 1000baseT-FDX, auto
[ 7.7697274] mue0: Ethernet address b8:27:eb:66:13:38
Not resizing /: already correct size
Starting file system checks:
/dev/rld0e: 229 files, 48492 free (12123 clusters)
random_seed: /var/db/entropy-file: Not present
Setting tty flags.
Setting sysctl variables:
ddb.onpanic: 1 -> 0
Starting network.
Hostname: armv7
IPv6 mode: host
Configuring network interfaces:.
Adding interface aliases:.
Waiting for DAD to complete for statically configured addresses...
Starting dhcpcd.
Starting mdnsd.
Building databases: dev, utmp, utmpx, services.
wsconscfg: screen 1 is already configured
wsconscfg: screen 2 is already configured
wsconscfg: screen 3 is already configured
Starting syslogd.
Mounting all file systems...
Clearing temporary files.
Updating fontconfig cache:Oct 19 02:46:51 armv7 dhcpcd[146]: mue0: failed to request information
Oct 19 02:46:51 armv7 dhcpcd[146]: mue0: failed to request information
done.
Creating a.out runtime link editor directory cache.
Checking quotas: done.
Setting securelevel: kern.securelevel: 0 -> 1
Starting virecover.
Starting devpubd.
Starting local daemons:.
machdep.cpu.frequency.target: 600 -> 1400
Updating motd.
Starting ntpd.
ssh-keygen: 1024 SHA256:0uBBYuLHNxBj62wpppdqB4Apy+vqJhUfQ+DG2V0VDzI root@armv7 (DSA)
ssh-keygen: 521 SHA256:OnuZ63XAzG0KkGp1kB8Vp6ZRPjWwkX05fvw063Q7g7s root@armv7 (ECDSA)
ssh-keygen: 256 SHA256:dGZh3t1ihi2p21FToPz52+fgmS6Bn9bBDgx4WP31fT8 root@armv7 (ED25519)
ssh-keygen: 3072 SHA256:DsdSxrMYiM5h1rHx5uVgW38xL/dspSzaTXKTrY9vdNw root@armv7 (RSA)
Starting sshd.
postfix: rebuilding /etc/mail/aliases (missing /etc/mail/aliases.db)
Starting postfix.
Starting inetd.
Starting cron.
Mon Oct 19 02:47:35 UTC 2020

NetBSD/evbarm (armv7) (constty)

login:
+ +

Logging in to NetBSD

The default account for the images are root without password.

+

You must set the password and configure ssh to allow root login before you can log in remotely.

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
NetBSD/evbarm (armv7) (constty)

login: root
Nov 30 15:08:07 armv7 login: ROOT LOGIN (root) on tty constty
Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
2018, 2019, 2020 The NetBSD Foundation, Inc. All rights reserved.
Copyright (c) 1982, 1986, 1989, 1991, 1993
The Regents of the University of California. All rights reserved.

NetBSD 9.1 (GENERIC) #0: Sun Oct 18 19:24:30 UTC 2020

Welcome to NetBSD!

We recommend that you create a non-root account and use su(1) for root access.
armv7# passwd
Changing password for root.
New Password:
Retype New Password:
armv7#

# vi /etc/ssh/sshd_config
PermitRootLogin yes
#PermitRootLogin prohibit-password

# /etc/rc.d/sshd reload
Reloading sshd config files.
+ +

System characteristics

uname

1
2
3
4
5
# uname -snrmp
NetBSD armv7 9.1 evbarm earmv7hf

# uname -ap
NetBSD armv7 9.1 NetBSD 9.1 (GENERIC) #0: Sun Oct 18 19:24:30 UTC 2020 mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/evbarm/compile/GENERIC evbarm earmv7hf
+ +

cpu

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# dmesg | grep cpu
[ 1.000000] cpus0 at simplebus0
[ 1.000000] cpu0 at cpus0: 600 MHz Cortex-A53 r0p4 (Cortex V8A core)
[ 1.000000] cpu0: DC enabled IC enabled WB enabled EABT branch prediction enabled
[ 1.000000] cpu0: 32KB/64B 2-way L1 VIPT Instruction cache
[ 1.000000] cpu0: 32KB/64B 4-way write-back-locking-C L1 PIPT Data cache
[ 1.000000] cpu0: 512KB/64B 16-way write-through L2 PIPT Unified cache
[ 1.000000] vfp0 at cpu0: NEON MPE (VFP 3.0+), rounding, NaN propagation, denormals
[ 1.000000] cpu1 at cpus0
[ 1.000000] cpu2 at cpus0
[ 1.000000] cpu3 at cpus0
[ 1.000003] cpu3: 600 MHz Cortex-A53 r0p4 (Cortex V8A core)
[ 1.653655] cpu3: DC enabled IC enabled WB enabled EABT branch prediction enabled
[ 1.693658] cpu3: 32KB/64B 2-way L1 VIPT Instruction cache
[ 1.723660] cpu3: 32KB/64B 4-way write-back-locking-C L1 PIPT Data cache
[ 1.763665] cpu3: 512KB/64B 16-way write-through L2 PIPT Unified cache
[ 1.793668] vfp3 at cpu3: NEON MPE (VFP 3.0+), rounding, NaN propagation, denormals
[ 1.833672] cpu1: 600 MHz Cortex-A53 r0p4 (Cortex V8A core)
[ 1.863676] cpu1: DC enabled IC enabled WB enabled EABT branch prediction enabled
[ 1.903680] cpu1: 32KB/64B 2-way L1 VIPT Instruction cache
[ 1.943685] cpu1: 32KB/64B 4-way write-back-locking-C L1 PIPT Data cache
[ 1.973688] cpu1: 512KB/64B 16-way write-through L2 PIPT Unified cache
[ 2.013692] vfp1 at cpu1: NEON MPE (VFP 3.0+), rounding, NaN propagation, denormals
[ 2.053698] cpu2: 600 MHz Cortex-A53 r0p4 (Cortex V8A core)
[ 2.083702] cpu2: DC enabled IC enabled WB enabled EABT branch prediction enabled
[ 2.123706] cpu2: 32KB/64B 2-way L1 VIPT Instruction cache
[ 2.163712] cpu2: 32KB/64B 4-way write-back-locking-C L1 PIPT Data cache
[ 2.203716] cpu2: 512KB/64B 16-way write-through L2 PIPT Unified cache
[ 2.233718] vfp2 at cpu2: NEON MPE (VFP 3.0+), rounding, NaN propagation, denormals
+ +

memory

1
2
3
4
5
6
7
8
9
10
11
# cat /proc/meminfo
total: used: free: shared: buffers: cached:
Mem: 974045184 261570560 712474624 0 196403200 234627072
Swap: 0 0 0
MemTotal: 951216 kB
MemFree: 695776 kB
MemShared: 0 kB
Buffers: 191800 kB
Cached: 229128 kB
SwapTotal: 0 kB
SwapFree: 0 kB
+ +

ure

Realtek RTL8152 Based USB Ethernet Adapter

+
1
2
3
4
5
6
7
8
9
10
11
12
13
# dmesg | grep ure0
[ 8.294435] ure0 at uhub3 port 1
[ 8.294435] ure0: Realtek (0xbda) USB 10/100 LAN (0x8152), rev 2.10/20.00, addr 5
[ 8.304437] ure0: RTL8152 ver 4c10
[ 8.394448] rlphy0 at ure0 phy 0: RTL8201E 10/100 media interface, rev. 2
[ 8.444457] ure0: Ethernet address 00:e0:4c:36:03:b4

# dmesg | grep mue0
[ 11.014923] mue0 at uhub2 port 1
[ 11.014923] mue0: vendor 0424 (0x424) product 7800 (0x7800), rev 2.10/3.00, addr 7
[ 11.304962] mue0: LAN7800 id 0x7800 rev 0x2
[ 11.334966] ukphy0 at mue0 phy 1: OUI 0x00800f, model 0x0013, rev. 2
[ 11.344968] mue0: Ethernet address b8:27:eb:66:13:38
+ +

sysctl

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
hw.disknames = ld0
hw.machine = evbarm
hw.machine_arch = earmv7hf
hw.model = raspberrypi,3-model-b-plus
hw.ncpu = 4
hw.ncpuonline = 4
hw.pagesize = 8192
hw.physmem = 994050048
hw.physmem64 = 994050048
hw.usermem = 980459520
hw.usermem64 = 980459520
kern.aio_listio_max = 512
kern.aio_max = 8192
kern.argmax = 262144
kern.clockrate: tick = 10000, tickadj = 40, hz = 100, profhz = 100, stathz = 100
kern.configname = GENERIC
kern.consdev = ttyE0
kern.dump_on_panic = 1
kern.expose_address = 1
kern.forkfsleep = 0
kern.fscale = 2048
kern.fsync = 1
kern.hardclock_ticks = 88819
kern.iov_max = 1024
kern.mbuf.mblowat = 16
kern.mbuf.mclbytes = 2048
kern.mbuf.mcllowat = 8
kern.mbuf.msize = 256
kern.mbuf.nmbclusters = 30336
kern.osrelease = 9.1
kern.osrevision = 901000000
kern.ostype = NetBSD
kern.timecounter.choice = clockinterrupt(q=0, f=100 Hz) armgtmr0(q=500, f=19200000 Hz) dummy(q=-1000000, f=1000000 Hz)
kern.timecounter.hardware = armgtmr0
kern.timecounter.timestepwarnings = 0
kern.version = NetBSD 9.1 (GENERIC) #0: Sun Oct 18 19:24:30 UTC 2020
machdep.board_model = 0
machdep.board_revision = 10494163
machdep.booted_device = ld0
machdep.cpu.frequency.available = 600 1400
machdep.cpu.frequency.current = 1400
machdep.cpu.frequency.max = 1400
machdep.cpu.frequency.min = 600
machdep.cpu.frequency.target = 1400
machdep.cpu_arch = 8A
machdep.cpu_id = 1091555380
machdep.firmware_revision = 1536600398
machdep.fpu_id = 1090732084
machdep.fpu_present = 1
machdep.hwdiv_present = 1
machdep.neon_present = 1
machdep.powersave = 1
machdep.printfataltraps = 0
machdep.serial = 0x66661338
machdep.simd_present = 1
machdep.simdex_present = 1
machdep.synchprim_present = 32
+ +

mmc

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# dmesg | grep mmc
[ 1.000003] mmcpwrseq0 at simplebus0autoconfiguration error: : couldn't get reset GPIOs
[ 2.393736] sdmmc0 at bcmsdhost0
[ 2.404406] sdmmc1 at sdhc0 slot 0
[ 2.533852] sdmmc0: direct I/O error 5, r=6 p=0xba649f2c write
[ 2.573857] sdmmc0: SD card status: 4-bit, C10, U1, V10, A1
[ 2.573857] ld0 at sdmmc0: <0x27:0x5048:SD64G:0x60:0xda7f8e63:0x14a>
[ 2.673869] sdmmc1: 4-bit width, 50.000 MHz
[ 2.703876] sdmmc1: MAX_BLK_SIZE1 = 64
[ 2.703876] sdmmc1: MAX_BLK_SIZE2 = 512
[ 2.703876] sdmmc1: MAX_BLK_SIZE3 = 512
[ 2.713874] sdmmc1: SDIO function
[ 2.713874] (manufacturer 0x2d0, product 0xa9a6) at sdmmc1 function 1 not configured
[ 2.723876] (manufacturer 0x2d0, product 0xa9a6) at sdmmc1 function 2 not configured
[ 2.733877] (manufacturer 0x2d0, product 0xa9a6, standard function interface code 0x2) at sdmmc1 function 3 not configured
+ +

mounts

1
2
3
4
5
6
7
# cat /proc/mounts
/dev/ld0a / ffs rw,noatime 0 0
/dev/ld0e /boot msdos rw 0 0
kernfs /kern kernfs rw 0 0
ptyfs /dev/pts ptyfs rw 0 0
procfs /proc proc rw 0 0
tmpfs /var/shm tmpfs rw 0 0
+ +

fdisk

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# fdisk /dev/rld0
Disk: /dev/rld0
NetBSD disklabel disk geometry:
cylinders: 7599, heads: 255, sectors/track: 63 (16065 sectors/cylinder)
total sectors: 122093568, bytes/sector: 512

BIOS disk geometry:
cylinders: 1023, heads: 255, sectors/track: 63 (16065 sectors/cylinder)
total sectors: 122093568

Partitions aligned to 2048 sector boundaries, offset 63

Partition table:
0: Primary DOS with 32 bit FAT - LBA (sysid 12)
start 32768, size 163840 (80 MB, Cyls 2/10/9-12/60/48), Active
1: NetBSD (sysid 169)
start 196608, size 121896960 (59520 MB, Cyls 12/60/49-7599/248/9)
PBR is not bootable: All bytes are identical (0x00)
2: <UNUSED>
3: <UNUSED>
First active partition: 0
Drive serial number: 0 (0x00000000)
+ +

disklabel

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# disklabel /dev/ld0
# /dev/ld0:
type: SCSI
disk: STORAGE DEVICE
label: fictitious
flags: removable
bytes/sector: 512
sectors/track: 32
tracks/cylinder: 64
sectors/cylinder: 2048
cylinders: 1163
total sectors: 122093568
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0 # microseconds
track-to-track seek: 0 # microseconds
drivedata: 0

8 partitions:
# size offset fstype [fsize bsize cpg/sgs]
a: 121896960 196608 4.2BSD 0 0 0 # (Cyl. 96 - 59615)
c: 122093568 0 unused 0 0 # (Cyl. 0 - 59615)
d: 122093568 0 unused 0 0 # (Cyl. 0 - 59615)
e: 163840 32768 MSDOS # (Cyl. 16 - 95)
+ +

List of processes after startup

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
armv7# ps -wxdlww
UID PID PPID CPU PRI NI VSZ RSS WCHAN STAT TTY TIME COMMAND
0 0 0 0 0 0 0 8264 - OKl ? 0:08.51 [system]
0 1 0 19358 81 0 6248 1784 wait Is ? 0:00.04 - init
0 146 1 0 85 0 8456 2424 kqueue Ss ? 0:00.20 |-- dhcpcd: [master] [ip4] [ip6]
0 196 1 0 85 0 12232 2664 kqueue Ss ? 0:00.19 |-- /usr/sbin/syslogd -s
0 378 1 0 85 0 11632 13304 pause Ss ? 0:00.17 |-- /usr/sbin/ntpd -p /var/run/ntpd.pid -g
0 508 1 3 85 0 15152 6008 select Is ? 0:00.23 |-- /usr/sbin/sshd
0 534 1 7488 84 0 6288 1120 devmon Is ? 0:00.00 |-- /sbin/devpubd
0 778 1 15309 82 0 7216 1728 kqueue Is ? 0:00.00 |-- /usr/sbin/inetd -l
0 857 1 0 85 0 15328 3080 kqueue Is ? 0:00.04 |-- /usr/libexec/postfix/master -w
0 942 1 0 85 0 8160 1864 nanoslp Is ? 0:00.01 |-- /usr/sbin/cron
0 821 1 217 85 0 13640 4944 wait Is ttyE0 0:00.13 `-- login
0 940 821 0 85 0 8760 2352 wait S ttyE0 0:00.17 `-- -sh
0 692 940 0 42 0 5960 1664 - O+ ttyE0 0:00.00 `-- ps -wxdlww
+ +

ifconfig

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# ifconfig -am
ure0: flags=0x8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
capabilities=3ff00<IP4CSUM_Rx,IP4CSUM_Tx,TCP4CSUM_Rx,TCP4CSUM_Tx>
capabilities=3ff00<UDP4CSUM_Rx,UDP4CSUM_Tx,TCP6CSUM_Rx,TCP6CSUM_Tx>
capabilities=3ff00<UDP6CSUM_Rx,UDP6CSUM_Tx>
enabled=0
ec_capabilities=1<VLAN_MTU>
ec_enabled=0
address: 00:e0:4c:36:03:b4
media: Ethernet autoselect (none)
status: no carrier
supported Ethernet media:
media 10baseT
media 10baseT mediaopt full-duplex
media 100baseTX
media 100baseTX mediaopt full-duplex
media autoselect
mue0: flags=0x8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
capabilities=7ff80<TSO4,IP4CSUM_Rx,IP4CSUM_Tx,TCP4CSUM_Rx>
capabilities=7ff80<TCP4CSUM_Tx,UDP4CSUM_Rx,UDP4CSUM_Tx,TCP6CSUM_Rx>
capabilities=7ff80<TCP6CSUM_Tx,UDP6CSUM_Rx,UDP6CSUM_Tx,TSO6>
enabled=0
ec_capabilities=1<VLAN_MTU>
ec_enabled=0
address: b8:27:eb:66:13:38
media: Ethernet autoselect (100baseTX full-duplex)
status: active
supported Ethernet media:
media none
media 10baseT
media 10baseT mediaopt full-duplex
media 100baseTX
media 100baseTX mediaopt full-duplex
media 1000baseT
media 1000baseT mediaopt full-duplex
media autoselect
inet6 fe80::60fc:82ab:c140:c7d1%mue0/64 flags 0x0 scopeid 0x2
inet6 2409:8a55:8bc:dda0:a6cf:5bf6:c34e:b3de/64 flags 0x0
inet 192.168.1.5/24 broadcast 192.168.1.255 flags 0x0
lo0: flags=0x8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 33176
inet6 ::1/128 flags 0x20<NODAD>
inet6 fe80::1%lo0/64 flags 0x0 scopeid 0x3
inet 127.0.0.1/8 flags 0x0
+ +

Compiler

1
2
3
4
5
6
7
8
9
10
11
# ld -v
GNU ld (NetBSD Binutils nb1) 2.31.1

# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/lto-wrapper
Target: armv7--netbsdelf-eabihf
Configured with: /usr/src/tools/gcc/../../external/gpl3/gcc/dist/configure --target=armv7--netbsdelf-eabihf --enable-long-long --enable-threads --with-bugurl=http://www.NetBSD.org/Misc/send-pr.html --with-pkgversion='NetBSD nb4 20200810' --with-system-zlib --without-isl --enable-__cxa_atexit --enable-libstdcxx-time=rt --enable-libstdcxx-threads --with-diagnostics-color=auto-if-env --with-default-libstdcxx-abi=new --with-mpc-lib=/var/obj/mknative/evbarm-earmv7hf/usr/src/external/lgpl3/mpc/lib/libmpc --with-mpfr-lib=/var/obj/mknative/evbarm-earmv7hf/usr/src/external/lgpl3/mpfr/lib/libmpfr --with-gmp-lib=/var/obj/mknative/evbarm-earmv7hf/usr/src/external/lgpl3/gmp/lib/libgmp --with-mpc-include=/usr/src/external/lgpl3/mpc/dist/src --with-mpfr-include=/usr/src/external/lgpl3/mpfr/dist/src --with-gmp-include=/usr/src/external/lgpl3/gmp/lib/libgmp/arch/arm --enable-tls --enable-initfini-array --disable-multilib --disable-libstdcxx-pch --build=armv7--netbsdelf-eabihf --host=armv7--netbsdelf-eabihf --with-sysroot=/var/obj/mknative/evbarm-earmv7hf/usr/src/destdir.evbarm
Thread model: posix
gcc version 7.5.0 (nb4 20200810)
+ +

NetBSD Packages Collection

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
export PKG_PATH="http://cdn.NetBSD.org/pub/pkgsrc/packages/$(uname -s)/$(uname -m)/$(uname -r | cut -f '1 2' -d.)/All/"
export PKG_PATH="http://cdn.netbsd.org/pub/pkgsrc/packages/NetBSD/earmv7hf/9.1/All/;http://cdn.netbsd.org/pub/pkgsrc/packages/NetBSD/earmv7hf/9.0/All/"

pkg_admin fetch-pkg-vulnerabilities

pkg_add -uv tmux bash pkgin avahi clang python38

pkg_info tmux

pkg_delete -r jpeg

cat << EOF > /usr/pkg/etc/pkgin/repositories.conf
#
# Pkgin repositories list
#
# Simply add repositories URIs one below the other
#
# WARNING: order matters, duplicates will not be added, if two
# repositories hold the same package, it will be fetched from
# the first one listed in this file.
#

http://cdn.netbsd.org/pub/pkgsrc/packages/NetBSD/earmv7hf/9.1/All/
http://cdn.netbsd.org/pub/pkgsrc/packages/NetBSD/earmv7hf/9.0/All/
EOF

pkgin update
pkgin upgrade
pkgin avail
pkgin list
pkgin search foo.*bar
pkgin install 'foo<5.0' bar baz
pkgin show-full-deps foo
pkgin show-rev-deps foo
pkgin requires foo
pkgin remove foo
pkgin autoremove
pkgin clean
pkgin export > my-packages
pkgin import my-packages
pkgin provides foo
pkgin pkg-content foo
+ +

Conclusion

NetBSD 9.1 earmv7hf can use my Realtek RTL8152 Based USB Ethernet Adapter, it’s works very good. +But is can’t found WiFi Adapter in Raspberry Pi 3 Model B Plus Rev 1.3, it’s really disappointing.

+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/11/29/freebsd-12-arm64-on-raspberry-pi-3b/index.html b/2020/11/29/freebsd-12-arm64-on-raspberry-pi-3b/index.html new file mode 100644 index 00000000..4aa94dc6 --- /dev/null +++ b/2020/11/29/freebsd-12-arm64-on-raspberry-pi-3b/index.html @@ -0,0 +1,247 @@ + + + + + + + + + + + + FreeBSD 12 arm64 on Raspberry Pi 3B+ | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ FreeBSD 12 arm64 on Raspberry Pi 3B+ +

+ +

FreeBSD 12 arm64 on Raspberry Pi 3B+

Download FreeBSD image

+
1
2
3
4
5
$ aria2c https://download.freebsd.org/ftp/releases/arm64/aarch64/ISO-IMAGES/12.2/FreeBSD-12.2-RELEASE-arm64-aarch64-RPI3.img.xz

FREEBSD_STABLE_ROOT=https://download.freebsd.org/ftp/snapshots/arm64/aarch64/ISO-IMAGES/12.2
FREEBSD_STABLE_FILE=`curl -sS ${FREEBSD_STABLE_ROOT}/ | grep -oP "(FreeBSD-.*?-STABLE-arm64-aarch64-RPI3-.*?xz)" | tail -1`
aria2c ${FREEBSD_STABLE_ROOT}/${FREEBSD_STABLE_FILE}
+ +

Write image to SDXC card

1
2
3
4
5
6
7
8
9
$ cat FreeBSD-12.2-RELEASE-arm64-aarch64-RPI3.img.xz | xz -cd | sudo dd of=/dev/sdb bs=4M oflag=sync status=progress; time sync
3205439488 bytes (3.2 GB, 3.0 GiB) copied, 185 s, 17.3 MB/s
0+49215 records in
0+49215 records out
3221225472 bytes (3.2 GB, 3.0 GiB) copied, 185.924 s, 17.3 MB/s

real 0m0.005s
user 0m0.001s
sys 0m0.000s
+ +

Booting Raspberry Pi

1
$ sudo minicom -b 115200 -8 -D /dev/ttyUSB0
+ +
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
U-Boot 2020.07 (Oct 23 2020 - 01:37:07 +0000)

DRAM: 948 MiB
RPI 3 Model B+ (0xa020d3)
MMC: mmc@7e300000: 0
Loading Environment from FAT... In: serial
Out: vidconsole
Err: vidconsole
Net: No ethernet found.
starting USB...
Bus usb@7e980000: USB DWC2
scanning bus usb@7e980000 for devices... 4 USB Device(s) found
scanning usb for storage devices... 0 Storage Device(s) found
Hit any key to stop autoboot: 0
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
Found EFI removable media binary efi/boot/bootaa64.efi
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
Scanning disk mmc@7e300000.blk...
** Unrecognized filesystem type **
Found 3 disks
BootOrder not defined
EFI boot manager: Cannot load any image
640224 bytes read in 62 ms (9.8 MiB/s)
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
Consoles: EFI console
Reading loader env vars from /efi/freebsd/loader.env
Setting currdev to disk0p1:
FreeBSD/arm64 EFI loader, Revision 1.1

Command line arguments: loader.efi
EFI version: 2.80
EFI Firmware: Das U-Boot (rev 8224.1792)
Console: efi (0)
Load Path: /efi\boot\bootaa64.efi
Load Device: /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(0)/SD(0)/HD(1,0x01,0,0x81f,0x18fa8)
Trying ESP: /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(0)/SD(0)/HD(1,0x01,0,0x81f,0x18fa8)
Setting currdev to disk0p1:
Trying: /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(0)/SD(0)/HD(2,0x01,0,0x197c7,0x5e6821)
Setting currdev to disk0p2:
Loading /boot/defaults/loader.conf
Loading /boot/defaults/loader.conf
Loading /boot/device.hints
Loading /boot/loader.conf
Loading /boot/loader.conf.local
Loading kernel...
/boot/kernel/kernel text=0x9081b4 data=0x185f50 data=0x0+0x2d0a3e syms=[0x8+0x134550+0x8+0x12137a]
Loading configured modules...
can't find '/etc/hostid'
/boot/kernel/umodem.ko text=0x1ba0 text=0xf60 data=0x610+0x8 syms=[0x8+0xe28+0x8+0xa7e]
can't find '/boot/entropy'

Hit [Enter] to boot immediately, or any other key for command prompt.
Booting [/boot/kernel/kernel]...
Using DTB provided by EFI at 0x7ef6000.
EFI framebuffer information:
addr, size 0x3e513000, 0x6d8c00
dimensions 1824 x 984
stride 1824
masks 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000
---<<BOOT>>---
Copyright (c) 1992-2020 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 12.2-RELEASE r366954 GENERIC arm64
FreeBSD clang version 10.0.1 (git@github.com:llvm/llvm-project.git llvmorg-10.0.1-0-gef32c611aa2)
VT(efifb): resolution 1824x984
KLD file umodem.ko is missing dependencies
real memory = 993849344 (947 MB)
avail memory = 950001664 (905 MB)
Starting CPU 1 (1)
Starting CPU 2 (2)
Starting CPU 3 (3)
FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs
arc4random: no preloaded entropy cache
random: entropy device external interface
MAP 39f3e000 mode 2 pages 1
MAP 39f44000 mode 2 pages 2
MAP 3b350000 mode 2 pages 16
MAP 3f100000 mode 0 pages 1
kbd0 at kbdmux0
ofwbus0: <Open Firmware Device Tree>
simplebus0: <Flattened device tree simple bus> on ofwbus0
ofw_clkbus0: <OFW clocks bus> on ofwbus0
clk_fixed0: <Fixed clock> on ofw_clkbus0
clk_fixed1: <Fixed clock> on ofw_clkbus0
regfix0: <Fixed Regulator> on ofwbus0
regfix1: <Fixed Regulator> on ofwbus0
psci0: <ARM Power State Co-ordination Interface Driver> on ofwbus0
lintc0: <BCM2836 Interrupt Controller> mem 0x40000000-0x400000ff on simplebus0
intc0: <BCM2835 Interrupt Controller> mem 0x7e00b200-0x7e00b3ff irq 48 on simplebus0
gpio0: <BCM2708/2835 GPIO controller> mem 0x7e200000-0x7e2000b3 irq 24,25 on simplebus0
gpiobus0: <OFW GPIO bus> on gpio0
generic_timer0: <ARMv7 Generic Timer> irq 1,2,3,4 on ofwbus0
Timecounter "ARM MPCore Timecounter" frequency 19200000 Hz quality 1000
Event timer "ARM MPCore Eventtimer" frequency 19200000 Hz quality 1000
usb_nop_xceiv0: <USB NOP PHY> on ofwbus0
bcm_dma0: <BCM2835 DMA Controller> mem 0x7e007000-0x7e007eff irq 6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21 on simplebus0
bcmwd0: <BCM2708/2835 Watchdog> mem 0x7e100000-0x7e100113,0x7e00a000-0x7e00a023 on simplebus0
bcm2835_clkman0: <BCM283x Clock Manager> mem 0x7e101000-0x7e102fff on simplebus0
bcmrng0: <Broadcom BCM2835 RNG> mem 0x7e104000-0x7e10400f irq 22 on simplebus0
mbox0: <BCM2835 VideoCore Mailbox> mem 0x7e00b880-0x7e00b8bf irq 23 on simplebus0
gpioc0: <GPIO controller> on gpio0
uart0: <PrimeCell UART (PL011)> mem 0x7e201000-0x7e2011ff irq 26 on simplebus0
uart0: console (115200,n,8,1)
spi0: <BCM2708/2835 SPI controller> mem 0x7e204000-0x7e2041ff irq 28 on simplebus0
spibus0: <OFW SPI bus> on spi0
spibus0: <unknown card> at cs 0 mode 0
spibus0: <unknown card> at cs 1 mode 0
iichb0: <BCM2708/2835 BSC controller> mem 0x7e804000-0x7e804fff irq 40 on simplebus0
bcm283x_dwcotg0: <DWC OTG 2.0 integrated USB controller (bcm283x)> mem 0x7e980000-0x7e98ffff,0x7e006000-0x7e006fff irq 46,47 on simplebus0
usbus0 on bcm283x_dwcotg0
sdhci_bcm0: <Broadcom 2708 SDHCI controller> mem 0x7e300000-0x7e3000ff irq 50 on simplebus0
mmc0: <MMC/SD bus> on sdhci_bcm0
fb0: <BCM2835 VT framebuffer driver> on simplebus0
fb0: keeping existing fb bpp of 32
fbd0 on fb0
VT: Replacing driver "efifb" with new "fb".
fb0: 1824x984(1824x984@0,0) 32bpp
fb0: fbswap: 1, pitch 7296, base 0x3e513000, screen_size 7237632
pmu0: <Performance Monitoring Unit> irq 0 on ofwbus0
cpulist0: <Open Firmware CPU Group> on ofwbus0
cpu0: <Open Firmware CPU> on cpulist0
bcm2835_cpufreq0: <CPU Frequency Control> on cpu0
cpu1: <Open Firmware CPU> on cpulist0
cpu2: <Open Firmware CPU> on cpulist0
cpu3: <Open Firmware CPU> on cpulist0
gpioled0: <GPIO LEDs> on ofwbus0
gpioled0: <led1> failed to map pin
cryptosoft0: <software crypto>
Timecounters tick every 1.000 msec
iicbus0: <OFW I2C bus> on iichb0
iic0: <I2C generic I/O> on iicbus0
usbus0: 480Mbps High Speed USB v2.0
ugen0.1: <DWCOTG OTG Root HUB> at usbus0
uhub0: <DWCOTG OTG Root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus0
mmcsd0: 63GB <SDHC SD64G 6.0 SN DA7F8E63 MFG 10/2020 by 39 PH> at mmc0 50.0MHz/4bit/65535-block
mbox0: mbox response error
bcm2835_cpufreq0: can't get clock rate (id=8)
bcm2835_cpufreq0: ARM 600MHz, Core 250MHz, SDRAM -999MHz, Turbo OFF
Release APs...done
CPU 0: ARM Cortex-A53 r0p4 affinity: 0
arc4random: no preloaded entropy cache
Instruction Set Attributes 0 = <CRC32>
Trying to mount root from ufs:/dev/ufs/rootfs [rw]...
Instruction Set Attributes 1 = <>
Processor Features 0 = <AdvSIMD,Float,EL3 32,EL2 32,EL1 32,EL0 32>
Processor Features 1 = <0>
Memory Model Features 0 = <4k Granule,64k Granule,S/NS Mem,MixedEndian,16bit ASID,1TB PA>
Memory Model Features 1 = <>
Memory Model Features 2 = <32b CCIDX,48b VA>
Debug Features 0 = <2 CTX Breakpoints,4 Watchpoints,6 Breakpoints,PMUv3,Debug v8>
Debug Features 1 = <0>
Auxiliary Features 0 = <0>
Auxiliary Features 1 = <0>
CPU 1: ARM Cortex-A53 r0p4 affinity: 1
CPU 2: ARM Cortex-A53 r0p4 affinity: 2
CPU 3: ARM Cortex-A53 r0p4 affinity: 3
arc4random: no preloaded entropy cache
Warning: no time-of-day clock registered, system time will not be set accurately
uhub0: 1 port with 1 removable, self powered
arc4random: no preloaded entropy cache
Growing root partition to fill device
random: read_random_uio unblock wait
ugen0.2: <vendor 0x0424 product 0x2514> at usbus0
uhub1 on uhub0
uhub1: <vendor 0x0424 product 0x2514, class 9/0, rev 2.00/b.b3, addr 2> on usbus0
uhub1: MTT enabled
uhub1: 4 ports with 3 removable, self powered
random: unblocking device.
ugen0.3: <vendor 0x0424 product 0x2514> at usbus0
uhub2 on uhub1
uhub2: <vendor 0x0424 product 0x2514, class 9/0, rev 2.00/b.b3, addr 3> on usbus0
uhub2: MTT enabled
GEOM_PART: mmcsd0s2 was automatically resized.
Use `gpart commit mmcsd0s2` to save changes or `gpart undo mmcsd0s2` to revert them.
mmcsd0s2 resized
mmcsd0s2a resized
gpart: arg0 'ufs/rootfs': Invalid argument
super-block backups (for fsck_ffs -b #) at:
6411392, 7693632, 8975872, 10258112, 11540352, 12822592, 14104832, 15387072,
16669312, 17951552, 19233792, 20516032, 21798272, 23080512, 24362752,
25644992, 26927232, 28209472, 29491712, 30773952, 32056192, 33338432,
34620672, 35902912, 37185152, 38467392, 39749632, 41031872, 42314112,
43596352, 44878592, 46160832, 47443072, 48725312, 50007552, 51289792,
52572032, 53854272, 55136512, 56418752, 57700992, 58983232,uhub2: 3 ports with 2 removable, self powered
60265472,
61547712, 62829952, 64112192, 65394432, 66676672, 67958912, 69241152,
70523392, 71805632, 73087872, 74370112, 75652352, 76934592, 78216832,
79499072, 80781312, 82063552, 83345792, 84628032, 85910272, 87192512,
88474752, 89756992, 91039232, 92321472, 93603712, 94885952, 96168192,
97450432, 98732672, 100014912, 101297152, 102579392, 103861632, 105143872,
106426112, 107708352, 108990592, 110272832, 111555072, 112837312, 114119552,
115401792, 116684032, 117966272, 119248512, 120530752, 121812992
ugen0.4: <vendor 0x0424 product 0x7800> at usbus0
muge0 on uhub2
muge0: <vendor 0x0424 product 0x7800, rev 2.10/3.00, addr 4> on usbus0
muge0: Chip ID 0x7800 rev 0002
Setting hostuuid: 30303030-3030-3030-3636-363631333338.
Setting hostid: 0x816ce8bf.
Starting file system checks:
miibus0: <MII bus> on muge0
ukphy0: <Generic IEEE 802.3u media interface> PHY 1 on miibus0
ukphy0: none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 1000baseT-master, 1000baseT-FDX, 1000baseT-FDX-master, auto
ue0: <USB Ethernet> on muge0
ue0: Ethernet address: b8:27:eb:66:13:38
/dev/ufs/rootfs: FILE SYSTEM CLEAN; SKIPPING CHECKS
/dev/ufs/rootfs: clean, 14112954 free (18 frags, 1764117 blocks, 0.0% fragmentation)
Mounting local filesystems:.
ELF ldconfig path: /lib /usr/lib /usr/lib/compat
Building /boot/kernel/linker.hints
Setting hostname: generic.
Setting up harvesting: [UMA],[FS_ATIME],SWI,INTERRUPT,NET_NG,NET_ETHER,NET_TUN,MOUSE,KEYBOARD,ATTACH,CACHED
Feeding entropy: .
lo0: link state changed to UP
muge0: Chip ID 0x7800 rev 0002
ue0: link state changed to DOWN
ue0: link state changed to UP
Starting Network: lo0 ue0.
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
inet 127.0.0.1 netmask 0xff000000
groups: lo
nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
ue0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=80009<RXCSUM,VLAN_MTU,LINKSTATE>
ether b8:27:eb:66:13:38
media: Ethernet autoselect (100baseTX <full-duplex>)
status: active
nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
Starting devd.
Starting dhclient.
DHCPDISCOVER on ue0 to 255.255.255.255 port 67 interval 6
DHCPOFFER from 192.168.1.1
unknown dhcp option value 0x7d
DHCPREQUEST on ue0 to 255.255.255.255 port 67
DHCPACK from 192.168.1.1
unknown dhcp option value 0x7d
bound to 192.168.1.8 -- renewal in 43200 seconds.
add host 127.0.0.1: gateway lo0 fib 0: route already in table
add host ::1: gateway lo0 fib 0: route already in table
add net fe80::: gateway ::1
add net ff02::: gateway ::1
add net ::ffff:0.0.0.0: gateway ::1
add net ::0.0.0.0: gateway ::1
Generating host.conf.
Creating and/or trimming log files.
Starting syslogd.
Clearing /tmp (X related).
Updating motd:.
Mounting late filesystems:.
Updating /var/run/os-release done.
Configuring vt: blanktime.
Generating RSA host key.
2048 SHA256:D48allvap5AHqcmhkVQQUiy0OgS/E6XmH2ioPMW3HWc root@generic (RSA)
Generating ECDSA host key.
256 SHA256:Ct89xJM8EqyHyxO6SBfI3/SoLYnnr/WE+4t+IvzTels root@generic (ECDSA)
Generating ED25519 host key.
256 SHA256:TINaQKiQ9MbblbWDBmIhAzzyYd78+cLjWYZXHuUj2xo root@generic (ED25519)
Performing sanity check on sshd configuration.
Starting sshd.
Starting cron.
Starting background file system checks in 60 seconds.

Fri Oct 23 03:50:22 UTC 2020

FreeBSD/arm64 (generic) (ttyu0)

login:
+ +

Logging in to FreeBSD

The default passwords for the images are freebsd/freebsd and root/root .

+

If you logging remotely, freebsd/freebsd is mandatory, since root remote login is disabled by default.

+
1
2
3
4
5
6
7
8
# vi /etc/ssh/sshd_config
PermitRootLogin yes
#PermitRootLogin prohibit-password
PasswordAuthentication yes
UseDNS no

# /etc/rc.d/sshd reload
Performing sanity check on sshd configuration.
+ +

cat /etc/os-release

1
2
3
4
5
6
7
8
9
10
11
12
13
# ls -l /etc/os-release
lrwxr-xr-x 1 root wheel 21 Oct 23 03:44 /etc/os-release -> ../var/run/os-release

# cat /etc/os-release
NAME=FreeBSD
VERSION=12.2-RELEASE
VERSION_ID=12.2
ID=freebsd
ANSI_COLOR="0;31"
PRETTY_NAME="FreeBSD 12.2-RELEASE"
CPE_NAME=cpe:/o:freebsd:freebsd:12.2
HOME_URL=https://FreeBSD.org/
BUG_REPORT_URL=https://bugs.FreeBSD.org/
+ +

System characteristics

uname

1
2
3
4
5
root@generic:~ # uname -snrmp
FreeBSD generic 12.2-RELEASE arm64 aarch64

root@generic:~ # uname -ap
FreeBSD generic 12.2-RELEASE FreeBSD 12.2-RELEASE r366954 GENERIC arm64 aarch64
+ +

cpu

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
root@generic:~ # dmesg | grep -i cpu
Starting CPU 1 (1)
Starting CPU 2 (2)
Starting CPU 3 (3)
FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs
cpulist0: <Open Firmware CPU Group> on ofwbus0
cpu0: <Open Firmware CPU> on cpulist0
bcm2835_cpufreq0: <CPU Frequency Control> on cpu0
cpu1: <Open Firmware CPU> on cpulist0
cpu2: <Open Firmware CPU> on cpulist0
cpu3: <Open Firmware CPU> on cpulist0
bcm2835_cpufreq0: can't get clock rate (id=8)
bcm2835_cpufreq0: ARM 600MHz, Core 250MHz, SDRAM -999MHz, Turbo OFF
CPU 0: ARM Cortex-A53 r0p4 affinity: 0
CPU 1: ARM Cortex-A53 r0p4 affinity: 1
CPU 2: ARM Cortex-A53 r0p4 affinity: 2
CPU 3: ARM Cortex-A53 r0p4 affinity: 3
+ +

ure

Realtek RTL8152 Based USB Ethernet Adapter

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
root@generic:~ # dmesg | grep -i -E "ure0|realtek"
ugen0.6: <Realtek USB 10/100 LAN> at usbus0
ure0 on uhub3
ure0: <Realtek USB 10/100 LAN, class 0/0, rev 2.10/20.00, addr 6> on usbus0
miibus1: <MII bus> on ure0
ue1: <USB Ethernet> on ure0

# dmesg | grep -i -E "Ethernet|ue0|muge"
muge0 on uhub2
muge0: <vendor 0x0424 product 0x7800, rev 2.10/3.00, addr 4> on usbus0
muge0: Chip ID 0x7800 rev 0002
miibus0: <MII bus> on muge0
ue0: <USB Ethernet> on muge0
ue0: Ethernet address: b8:27:eb:66:13:38
+ +

sysctl

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
hw.machine: arm64
hw.model: ARM Cortex-A53 r0p4
hw.ncpu: 4
hw.byteorder: 1234
hw.physmem: 974901248
hw.usermem: 856944640
hw.pagesize: 4096
hw.machine_arch: aarch64
hw.realmem: 993849344
hw.cpufreq.temperature: 43470
hw.cpufreq.voltage_sdram_p: 1200000
hw.cpufreq.voltage_sdram_i: 1250000
hw.cpufreq.voltage_sdram_c: 1250000
hw.cpufreq.voltage_core: 1200000
hw.cpufreq.turbo: 0
hw.cpufreq.sdram_freq: 400000000
hw.cpufreq.core_freq: 250000000
hw.cpufreq.arm_freq: 600000000
kern.argmax: 524288
kern.bootfile: /boot/kernel/kernel
kern.clockrate: { hz = 1000, tick = 1000, profhz = 8129, stathz = 127 }
kern.eventtimer.choice: ARM MPCore Eventtimer(1000)
kern.eventtimer.et.ARM MPCore Eventtimer.flags: 6
kern.eventtimer.et.ARM MPCore Eventtimer.frequency: 19200000
kern.eventtimer.et.ARM MPCore Eventtimer.quality: 1000
kern.eventtimer.idletick: 0
kern.eventtimer.periodic: 0
kern.eventtimer.singlemul: 2
kern.eventtimer.timer: ARM MPCore Eventtimer
kern.features.compat_freebsd_32bit: 1
kern.hwpmc.softevents: 16
kern.hz: 1000
kern.ident: GENERIC
kern.module_path: /boot/kernel;/boot/modules;/boot/dtb;/boot/dtb/overlays
kern.osreldate: 1202000
kern.osrelease: 12.2-RELEASE
kern.osrevision: 199506
kern.ostype: FreeBSD
kern.panic_reboot_wait_time: 15
kern.pid_max: 99999
kern.racct.enable: 0
kern.racct.pcpu_threshold: 1
kern.racct.rctl.devctl_rate_limit: 10
kern.racct.rctl.log_rate_limit: 10
kern.racct.rctl.maxbufsize: 16777216
kern.racct.rctl.throttle_max: 4294967295
kern.racct.rctl.throttle_min: 4294967295
kern.racct.rctl.throttle_pct2: 4294967295
kern.racct.rctl.throttle_pct: 4294967295
kern.random.fortuna.minpoolsize: 64
kern.random.harvest.mask: 511
kern.random.harvest.mask_bin: 000000000000000111111111
kern.random.harvest.mask_symbolic: [UMA],[FS_ATIME],SWI,INTERRUPT,NET_NG,NET_ETHER,NET_TUN,MOUSE,KEYBOARD,ATTACH,CACHED
kern.supported_archs: aarch64 armv7
kern.timecounter.alloweddeviation: 5
kern.timecounter.choice: ARM MPCore Timecounter(1000) dummy(-1000000)
kern.timecounter.fast_gettime: 1
kern.timecounter.hardware: ARM MPCore Timecounter
kern.timecounter.stepwarnings: 0
kern.timecounter.tc.ARM MPCore Timecounter.counter: 3051977945
kern.timecounter.tc.ARM MPCore Timecounter.frequency: 19200000
kern.timecounter.tc.ARM MPCore Timecounter.mask: 4294967295
kern.timecounter.tc.ARM MPCore Timecounter.quality: 1000
kern.timecounter.tick: 1
kern.timecounter.timehands_count: 2
kern.version: FreeBSD 12.2-RELEASE r366954 GENERIC
vm.max_kernel_address: 18446463148488654848
vm.min_kernel_address: 18446462598732840960
net.inet.ip.portrange.first: 10000
net.inet.ip.portrange.hifirst: 49152
net.inet.ip.portrange.hilast: 65535
net.inet.ip.portrange.last: 65535
net.inet.ip.portrange.lowfirst: 1023
net.inet.ip.portrange.lowlast: 600
+ +

mmc

1
2
3
4
5
6
# dmesg | grep mmc
sdhci_bcm0: <Broadcom 2708 SDHCI controller> mem 0x7e300000-0x7e3000ff irq 50 on simplebus0
mmc0: <MMC/SD bus> on sdhci_bcm0
mmcsd0: 63GB <SDHC SD64G 6.0 SN DA7F8E63 MFG 10/2020 by 39 PH> at mmc0 50.0MHz/4bit/65535-block
GEOM_PART: mmcsd0s2 was automatically resized.
Use `gpart commit mmcsd0s2` to save changes or `gpart undo mmcsd0s2` to revert them.
+ +

mounts

1
2
3
4
5
6
7
8
9
10
11
12
13
14
root@generic:~ # mount
/dev/ufs/rootfs on / (ufs, local, soft-updates)
devfs on /dev (devfs, local, multilabel)
/dev/msdosfs/MSDOSBOOT on /boot/msdos (msdosfs, local, noatime)
tmpfs on /tmp (tmpfs, local)
procfs on /proc (procfs, local)

root@generic:~ # df -h
Filesystem Size Used Avail Capacity Mounted on
/dev/ufs/rootfs 56G 2.8G 49G 5% /
devfs 1.0K 1.0K 0B 100% /dev
/dev/msdosfs/MSDOSBOOT 50M 14M 36M 28% /boot/msdos
tmpfs 50M 4.0K 50M 0% /tmp
procfs 4.0K 4.0K 0B 100% /proc
+ +

fdisk

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
root@generic:~ # diskinfo -v /dev/mmcsd0
/dev/mmcsd0
512 # sectorsize
62511906816 # mediasize in bytes (58G)
122093568 # mediasize in sectors
4194304 # stripesize
0 # stripeoffset
SDHC SD64G 6.0 SN DA7F8E63 MFG 10/2020 by 39 PH # Disk descr.
DA7F8E63 # Disk ident.
Yes # TRIM/UNMAP support
0 # Rotation rate in RPM

root@generic:~ # gpart show
=> 63 122093505 mmcsd0 MBR (58G)
63 2016 - free - (1.0M)
2079 102312 1 fat32lba [active] (50M)
104391 121989177 2 freebsd (58G)

=> 0 121989177 mmcsd0s2 BSD (58G)
0 57 - free - (29K)
57 121989120 1 freebsd-ufs (58G)
+ +

List of processes after startup

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# ps -wxdlww
UID PID PPID C PRI NI VSZ RSS MWCHAN STAT TT TIME COMMAND
0 0 0 1 -16 0 0 384 swapin DLs - 0:00.20 [kernel]
0 1 0 1 20 0 9868 564 wait ILs - 0:00.07 - /sbin/init --
0 614 1 1 24 0 11248 2456 select Is - 0:00.01 |-- dhclient: system.syslog (dhclient)
0 617 1 0 52 0 11456 2600 select Is - 0:00.01 |-- dhclient: ue0 [priv] (dhclient)
0 683 1 1 20 0 10340 1092 select Is - 0:00.00 |-- /sbin/devd
0 754 1 3 20 0 11252 2512 select Ss - 0:00.02 |-- /usr/sbin/syslogd -s
0 957 1 3 20 0 19132 7800 select Is - 0:00.06 |-- /usr/sbin/sshd
0 961 1 1 34 0 11268 2528 nanslp Is - 0:00.01 |-- /usr/sbin/cron -s
0 1034 1 2 20 0 11984 3156 wait Is u0 0:00.05 |-- login [pam] (login)
0 1035 1034 1 20 0 13012 3620 pause S u0 0:00.06 | `-- -csh (csh)
0 1057 1035 3 20 0 11644 2692 - R+ u0 0:00.00 | `-- ps -wxdlww
0 1008 1 1 52 0 10732 2160 ttyin Is+ v0 0:00.01 |-- /usr/libexec/getty Pc ttyv0
0 1009 1 0 52 0 10732 2160 ttyin Is+ v1 0:00.01 |-- /usr/libexec/getty Pc ttyv1
0 1010 1 3 52 0 10732 2160 ttyin Is+ v2 0:00.01 |-- /usr/libexec/getty Pc ttyv2
0 1011 1 2 52 0 10732 2160 ttyin Is+ v3 0:00.01 |-- /usr/libexec/getty Pc ttyv3
0 1012 1 2 52 0 10732 2160 ttyin Is+ v4 0:00.01 |-- /usr/libexec/getty Pc ttyv4
0 1013 1 2 52 0 10732 2160 ttyin Is+ v5 0:00.01 |-- /usr/libexec/getty Pc ttyv5
0 1014 1 1 52 0 10732 2160 ttyin Is+ v6 0:00.01 |-- /usr/libexec/getty Pc ttyv6
0 1015 1 1 52 0 10732 2160 ttyin Is+ v7 0:00.01 `-- /usr/libexec/getty Pc ttyv7
0 2 0 0 -16 0 0 16 crypto_w DL - 0:00.00 - [crypto]
0 3 0 0 -16 0 0 16 crypto_r DL - 0:00.00 - [crypto returns 0]
0 4 0 0 -16 0 0 16 crypto_r DL - 0:00.00 - [crypto returns 1]
0 5 0 0 -16 0 0 16 crypto_r DL - 0:00.00 - [crypto returns 2]
0 6 0 0 -16 0 0 16 crypto_r DL - 0:00.00 - [crypto returns 3]
0 7 0 0 -16 0 0 32 - DL - 0:00.00 - [cam]
0 8 0 1 -16 0 0 16 waiting_ DL - 0:00.00 - [sctp_iterator]
0 9 0 0 -16 0 0 16 - DL - 0:00.04 - [rand_harvestq]
0 10 0 0 -16 0 0 16 audit_wo DL - 0:00.00 - [audit]
0 11 0 0 155 0 0 64 - RNL - 23:34.32 - [idle]
0 12 0 0 -52 0 0 336 - WL - 0:02.72 - [intr]
0 13 0 3 -8 0 0 48 - DL - 0:00.13 - [geom]
0 14 0 0 -16 0 0 16 seqstate DL - 0:00.00 - [sequencer 00]
0 15 0 0 -68 0 0 96 - DL - 0:00.64 - [usb]
0 16 0 0 -16 0 0 16 - DL - 0:00.00 - [soaiod1]
0 17 0 0 -16 0 0 16 - DL - 0:00.00 - [soaiod2]
0 18 0 1 -16 0 0 16 - DL - 0:00.00 - [soaiod3]
0 19 0 0 -16 0 0 16 - DL - 0:00.00 - [soaiod4]
0 20 0 2 -16 0 0 16 mmcsd di DL - 0:00.10 - [mmcsd0: mmc/sd card]
0 21 0 0 -16 0 0 48 psleep DL - 0:00.03 - [pagedaemon]
0 22 0 2 -16 0 0 16 psleep DL - 0:00.00 - [vmdaemon]
0 23 0 0 -16 0 0 48 qsleep DL - 0:00.03 - [bufdaemon]
0 24 0 0 -16 0 0 16 vlruwt DL - 0:00.00 - [vnlru]
0 25 0 0 16 0 0 16 syncer DL - 0:00.05 - [syncer]
+ +

ifconfig

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# ifconfig -am
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
capabilities=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
inet 127.0.0.1 netmask 0xff000000
groups: lo
nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
ue0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=80009<RXCSUM,VLAN_MTU,LINKSTATE>
capabilities=80009<RXCSUM,VLAN_MTU,LINKSTATE>
ether b8:27:eb:66:13:38
inet 192.168.1.8 netmask 0xffffff00 broadcast 192.168.1.255
media: Ethernet autoselect (none)
status: no carrier
supported media:
media autoselect
media 1000baseT mediaopt full-duplex,master
media 1000baseT mediaopt full-duplex
media 1000baseT mediaopt master
media 1000baseT
media 100baseTX mediaopt full-duplex
media 100baseTX
media 10baseT/UTP mediaopt full-duplex
media 10baseT/UTP
media none
nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
ue1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=80000<LINKSTATE>
capabilities=80000<LINKSTATE>
ether 00:e0:4c:36:03:b4
inet 192.168.1.10 netmask 0xffffff00 broadcast 192.168.1.255
media: Ethernet autoselect (100baseTX <full-duplex>)
status: active
supported media:
media autoselect
media 100baseTX mediaopt full-duplex
media 100baseTX
media 10baseT/UTP mediaopt full-duplex
media 10baseT/UTP
nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
+ +

Compiler

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
root@generic:~ # file /bin/sh
/bin/sh: ELF 64-bit LSB executable, ARM aarch64, version 1 (FreeBSD), dynamically linked, interpreter /libexec/ld-elf.so.1, for FreeBSD 12.2, FreeBSD-style, stripped

root@generic:~ # ld -v
LLD 10.0.1 (FreeBSD llvmorg-10.0.1-0-gef32c611aa2-1200012) (compatible with GNU linkers)

root@generic:~ # cc -v
FreeBSD clang version 10.0.1 (git@github.com:llvm/llvm-project.git llvmorg-10.0.1-0-gef32c611aa2)
Target: aarch64-unknown-freebsd12.2
Thread model: posix
InstalledDir: /usr/bin

root@generic:~ # c++ -v
FreeBSD clang version 10.0.1 (git@github.com:llvm/llvm-project.git llvmorg-10.0.1-0-gef32c611aa2)
Target: aarch64-unknown-freebsd12.2
Thread model: posix
InstalledDir: /usr/bin
+ +

Using pkg for Binary Package Management

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
root@generic:~ # pkg update
Updating FreeBSD repository catalogue...
Fetching meta.conf: 100% 163 B 0.2kB/s 00:01
Fetching packagesite.txz: 100% 6 MiB 2.1MB/s 00:03
Processing entries: 100%
FreeBSD repository update completed. 30270 packages processed.
All repositories are up to date.

root@generic:~ # pkg upgrade
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
Updating database digests format: 100%
Checking for upgrades (1 candidates): 100%
Processing candidates (1 candidates): 100%
Checking integrity... done (0 conflicting)
Your packages are up to date.

root@generic:~ # pkg version
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
pkg-1.14.6

root@generic:~ # pkg install tmux bash python38 minicom
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 10 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
bash: 5.0.17
gettext-runtime: 0.20.2
indexinfo: 0.3.1
libevent: 2.1.12
libffi: 3.2.1_3
lrzsz: 0.12.20_4
minicom: 2.7.1_2
python38: 3.8.5
readline: 8.0.4
tmux: 3.1b

Number of packages to be installed: 10

The process will require 148 MiB more space.
19 MiB to be downloaded.

Proceed with this action? [y/N]: y
[1/10] Fetching tmux-3.1b.txz: 100% 276 KiB 282.3kB/s 00:01
[2/10] Fetching bash-5.0.17.txz: 100% 1 MiB 1.5MB/s 00:01
[3/10] Fetching python38-3.8.5.txz: 100% 16 MiB 2.5MB/s 00:07
[4/10] Fetching minicom-2.7.1_2.txz: 100% 227 KiB 232.8kB/s 00:01
[5/10] Fetching libevent-2.1.12.txz: 100% 266 KiB 272.6kB/s 00:01
[6/10] Fetching indexinfo-0.3.1.txz: 100% 5 KiB 5.6kB/s 00:01
[7/10] Fetching gettext-runtime-0.20.2.txz: 100% 151 KiB 155.0kB/s 00:01
[8/10] Fetching readline-8.0.4.txz: 100% 316 KiB 323.7kB/s 00:01
[9/10] Fetching libffi-3.2.1_3.txz: 100% 32 KiB 32.7kB/s 00:01
[10/10] Fetching lrzsz-0.12.20_4.txz: 100% 65 KiB 67.0kB/s 00:01
Checking integrity... done (0 conflicting)
[1/10] Installing indexinfo-0.3.1...
[1/10] Extracting indexinfo-0.3.1: 100%
[2/10] Installing gettext-runtime-0.20.2...
[2/10] Extracting gettext-runtime-0.20.2: 100%
[3/10] Installing libevent-2.1.12...
[3/10] Extracting libevent-2.1.12: 100%
[4/10] Installing readline-8.0.4...
[4/10] Extracting readline-8.0.4: 100%
[5/10] Installing libffi-3.2.1_3...
[5/10] Extracting libffi-3.2.1_3: 100%
[6/10] Installing lrzsz-0.12.20_4...
[6/10] Extracting lrzsz-0.12.20_4: 100%
[7/10] Installing tmux-3.1b...
[7/10] Extracting tmux-3.1b: 100%
[8/10] Installing bash-5.0.17...
[8/10] Extracting bash-5.0.17: 100%
[9/10] Installing python38-3.8.5...
[9/10] Extracting python38-3.8.5: 100%
[10/10] Installing minicom-2.7.1_2...
[10/10] Extracting minicom-2.7.1_2: 100%
+ +

Conclusion

FreeBSD 12.2 arm64 can use my Realtek RTL8152 Based USB Ethernet Adapter, it’s works very good. But is can’t found WiFi Adapter in Raspberry Pi 3 Model B Plus Rev 1.3, it’s really disappointing.

+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/11/29/openbsd-6-8-arm64-on-raspberry-pi-3b/index.html b/2020/11/29/openbsd-6-8-arm64-on-raspberry-pi-3b/index.html new file mode 100644 index 00000000..a7b3ed67 --- /dev/null +++ b/2020/11/29/openbsd-6-8-arm64-on-raspberry-pi-3b/index.html @@ -0,0 +1,256 @@ + + + + + + + + + + + + OpenBSD 6.8 arm64 on Raspberry Pi 3B+ | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ OpenBSD 6.8 arm64 on Raspberry Pi 3B+ +

+ +

OpenBSD 6.8 arm64 on Raspberry Pi 3B+

Download OpenBSD image

+
1
$ aria2c https://cdn.openbsd.org/pub/OpenBSD/6.8/arm64/miniroot68.img
+ +

Write image to SDXC card

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
$ cat miniroot68.img | sudo dd of=/dev/sdb bs=1M oflag=sync status=progress; time sync
17498112 bytes (17 MB, 17 MiB) copied, 1 s, 17.4 MB/s
0+528 records in
0+528 records out
34603008 bytes (35 MB, 33 MiB) copied, 1.97157 s, 17.6 MB/s

real 0m0.004s
user 0m0.002s
sys 0m0.000s

$ lsblk /dev/mmcblk0
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
mmcblk0 179:0 0 58.2G 0 disk
├─mmcblk0p1 179:1 0 4M 0 part /media/dongsheng/BOOT
└─mmcblk0p4 179:4 0 13M 0 part /media/dongsheng/5f7a8b9eaf6a1d6d

$ sudo fdisk -l /dev/mmcblk0
Disk /dev/mmcblk0: 58.22 GiB, 62511906816 bytes, 122093568 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 * 32768 40959 8192 4M c W95 FAT32 (LBA)
/dev/mmcblk0p4 40960 67583 26624 13M a6 OpenBSD

$ sudo gdisk -l /dev/mmcblk0
GPT fdisk (gdisk) version 1.0.5

Partition table scan:
MBR: MBR only
BSD: not present
APM: not present
GPT: not present


***************************************************************
Found invalid GPT and valid MBR; converting MBR to GPT format
in memory.
***************************************************************

Disk /dev/mmcblk0: 122093568 sectors, 58.2 GiB
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): E7876236-8DD4-49E6-8E3D-B95F04CCB477
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 122093534
Partitions will be aligned on 2048-sector boundaries
Total free space is 122058685 sectors (58.2 GiB)

Number Start (sector) End (sector) Size Code Name
1 32768 40959 4.0 MiB 0700 Microsoft basic data
4 40960 67583 13.0 MiB A600 OpenBSD disklabel

$ find BOOT/ -type f | xargs ls -ln
-rw-r--r-- 1 1000 1000 27980 Oct 5 02:57 BOOT/bcm2710-rpi-3-b.dtb
-rw-r--r-- 1 1000 1000 28599 Oct 5 02:57 BOOT/bcm2710-rpi-3-b-plus.dtb
-rw-r--r-- 1 1000 1000 26289 Oct 5 02:57 BOOT/bcm2710-rpi-cm3.dtb
-rw-r--r-- 1 1000 1000 52480 Oct 5 02:57 BOOT/bootcode.bin
-rw-r--r-- 1 1000 1000 65 Oct 5 02:57 BOOT/config.txt
-r--r--r-- 1 1000 1000 168696 Oct 5 02:57 BOOT/efi/boot/bootaa64.efi
-rw-r--r-- 1 1000 1000 13 Oct 5 02:57 BOOT/efi/boot/startup.nsh
-rw-r--r-- 1 1000 1000 7285 Oct 5 02:57 BOOT/fixup.dat
-rw-r--r-- 1 1000 1000 1073 Oct 5 02:57 BOOT/overlays/disable-bt.dtbo
-rw-r--r-- 1 1000 1000 3002048 Oct 5 02:57 BOOT/start.elf
-rw-r--r-- 1 1000 1000 508776 Oct 5 02:57 BOOT/u-boot.bin
+ +

Booting Raspberry Pi

minicom

1
$ sudo minicom -b 115200 -8 -D /dev/ttyUSB0
+ +

firmware

1
2
3
4
5
6
7
bwfm0: failed loadfirmware of file brcmfmac43455-sdio.bin

bwfm-firmware-20200316.1.2.tgz: http://firmware.openbsd.org/firmware/6.8/
linux-firmware-raspbian: https://packages.debian.org/sid/firmware-brcm80211

Name: brcmfmac43455-sdio.bin
Name: brcmfmac43455-sdio.raspberrypi,3-model-b-plus.txt
+ +

Install

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
U-Boot 2020.07 (Sep 13 2020 - 13:13:43 -0600)

DRAM: 948 MiB
RPI 3 Model B+ (0xa020d3)
MMC: mmc@7e202000: 0, mmcnr@7e300000: 1
Loading Environment from FAT... *** Warning - bad CRC, using default environment

In: serial
Out: vidconsole
Err: vidconsole
Net: No ethernet found.
starting USB...
Bus usb@7e980000: USB DWC2
scanning bus usb@7e980000 for devices... 6 USB Device(s) found
scanning usb for storage devices... 0 Storage Device(s) found
Hit any key to stop autoboot: 0
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
Found EFI removable media binary efi/boot/bootaa64.efi
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
Scanning disk mmc@7e202000.blk...
** Unrecognized filesystem type **
Card did not respond to voltage select!
Scanning disk mmcnr@7e300000.blk...
Disk mmcnr@7e300000.blk not ready
Found 3 disks
BootOrder not defined
EFI boot manager: Cannot load any image
168696 bytes read in 12 ms (13.4 MiB/s)
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
disks: sd0*
>> OpenBSD/arm64 BOOTAA64 1.2
boot>
cannot open sd0a:/etc/random.seed: No such file or directory
booting sd0a:/bsd: 2352340+659260+8777560+681840 [195371+109+573336+214661]=0xff5c48
type 0x0 pa 0x0 va 0x0 pages 0x1 attr 0x8
type 0x7 pa 0x1000 va 0x1000 pages 0x1ff attr 0x8
type 0x2 pa 0x200000 va 0x200000 pages 0x4000 attr 0x8
type 0x7 pa 0x4200000 va 0x4200000 pages 0x3cf5 attr 0x8
type 0x9 pa 0x7ef5000 va 0x7ef5000 pages 0x16 attr 0x8
type 0x7 pa 0x7f0b000 va 0x7f0b000 pages 0x31337 attr 0x8
type 0x2 pa 0x39242000 va 0x39242000 pages 0xbc4 attr 0x8
type 0x4 pa 0x39e06000 va 0x39e06000 pages 0x1 attr 0x8
type 0x2 pa 0x39e07000 va 0x39e07000 pages 0x3 attr 0x8
type 0x7 pa 0x39e0a000 va 0x39e0a000 pages 0x1 attr 0x8
type 0x2 pa 0x39e0b000 va 0x39e0b000 pages 0x100 attr 0x8
type 0x1 pa 0x39f0b000 va 0x39f0b000 pages 0x2a attr 0x8
type 0x0 pa 0x39f35000 va 0x39f35000 pages 0x7 attr 0x8
type 0x4 pa 0x39f3c000 va 0x39f3c000 pages 0x1 attr 0x8
type 0x6 pa 0x39f3d000 va 0xa3863000 pages 0x1 attr 0x8000000000000008
type 0x4 pa 0x39f3e000 va 0x39f3e000 pages 0x2 attr 0x8
type 0x0 pa 0x39f40000 va 0x39f40000 pages 0x1 attr 0x8
type 0x4 pa 0x39f41000 va 0x39f41000 pages 0x2 attr 0x8
type 0x6 pa 0x39f43000 va 0xa3869000 pages 0x2 attr 0x8000000000000008
type 0x0 pa 0x39f45000 va 0x39f45000 pages 0x1 attr 0x8
type 0x4 pa 0x39f46000 va 0x39f46000 pages 0x1 attr 0x8
type 0x0 pa 0x39f47000 va 0x39f47000 pages 0x1 attr 0x8
type 0x4 pa 0x39f48000 va 0x39f48000 pages 0x2 attr 0x8
type 0x0 pa 0x39f4a000 va 0x39f4a000 pages 0x1 attr 0x8
type 0x2 pa 0x39f4b000 va 0x39f4b000 pages 0x1405 attr 0x8
type 0x5 pa 0x3b350000 va 0xa4c76000 pages 0x10 attr 0x8000000000000008
type 0x2 pa 0x3b360000 va 0x3b360000 pages 0xa0 attr 0x8
type 0xb pa 0x3f100000 va 0xa4c86000 pages 0x1 attr 0x8000000000000000
Copyright (c) 1982, 1986, 1989, 1991, 1993
The Regents of the University of California. All rights reserved.
Copyright (c) 1995-2020 OpenBSD. All rights reserved. https://www.OpenBSD.org

OpenBSD 6.8 (RAMDISK) #780: Sun Oct 4 20:57:28 MDT 2020
deraadt@arm64.openbsd.org:/usr/src/sys/arch/arm64/compile/RAMDISK
real mem = 958574592 (914MB)
avail mem = 896290816 (854MB)
random: boothowto does not indicate good seed
mainbus0 at root: Raspberry Pi 3 Model B Plus Rev 1.3
cpu0 at mainbus0 mpidr 0: ARM Cortex-A53 r0p4
cpu0: 32KB 64b/line 2-way L1 VIPT I-cache, 32KB 64b/line 4-way L1 D-cache
cpu0: 512KB 64b/line 16-way L2 cache
efi0 at mainbus0: UEFI 2.8
efi0: Das U-Boot rev 0x20200700
simplefb0 at mainbus0: 1824x984, 32bpp
wsdisplay0 at simplefb0
wsdisplay0: screen 0 added (std, vt100 emulation)
"system" at mainbus0 not configured
"axi" at mainbus0 not configured
simplebus0 at mainbus0: "soc"
bcmclock0 at simplebus0
bcmmbox0 at simplebus0
bcmgpio0 at simplebus0
bcmaux0 at simplebus0
bcmdmac0 at simplebus0: DMA0 DMA2 DMA4 DMA5 DMA8 DMA9 DMA10
bcmintc0 at simplebus0
bcmrng0 at simplebus0
pluart0 at simplebus0: console
bcmsdhost0 at simplebus0: 250 MHz base clock
sdmmc0 at bcmsdhost0: 4-bit, sd high-speed, mmc high-speed, dma
dwctwo0 at simplebus0
bcmdog0 at simplebus0
"thermal" at simplebus0 not configured
"local_intc" at simplebus0 not configured
sdhc0 at simplebus0
sdhc0: SDHC 3.0, 200 MHz base clock
sdmmc1 at sdhc0: 4-bit, sd high-speed, mmc high-speed
simplebus1 at simplebus0: "firmware"
"clocks" at simplebus1 not configured
"expgpio" at simplebus1 not configured
"power" at simplebus0 not configured
"mailbox" at simplebus0 not configured
"gpiomem" at simplebus0 not configured
"fb" at simplebus0 not configured
"vcsm" at simplebus0 not configured
"clocks" at mainbus0 not configured
"phy" at mainbus0 not configured
"arm-pmu" at mainbus0 not configured
agtimer0 at mainbus0: tick rate 19200 KHz
"leds" at mainbus0 not configured
"fixedregulator_3v3" at mainbus0 not configured
"fixedregulator_5v0" at mainbus0 not configured
usb0 at dwctwo0: USB revision 2.0
scsibus0 at sdmmc0: 2 targets, initiator 0
sd0 at scsibus0 targ 1 lun 0: <SD/MMC, SD64G, 0060> removable
sd0: 59616MB, 512 bytes/sector, 122093568 sectors
uhub0 at usb0 configuration 1 interface 0 "Broadcom DWC2 root hub" rev 2.00/1.00 addr 1
uhub1 at uhub0 port 1 configuration 1 interface 0 "Standard Microsystems product 0x2514" rev 2.00/b.b3 addr 2
bwfm0 at sdmmc1 function 1
uhub2 at uhub1 port 1 configuration 1 interface 0 "Standard Microsystems product 0x2514" rev 2.00/b.b3 addr 3
manufacturer 0x02d0, product 0xa9a6 at sdmmc1 function 2 not configured
manufacturer 0x02d0, product 0xa9a6 at sdmmc1 function 3 not configured
uhub3 at uhub2 port 3 configuration 1 interface 0 "vendor 0x214b USB2.0 HUB" rev 2.00/1.00 addr 4
ure0 at uhub3 port 1 configuration 1 interface 0 "Realtek USB 10/100 LAN" rev 2.10/20.00 addr 5
ure0: RTL8152 (0x4c10), address 00:e0:4c:36:03:b4
rlphy0 at ure0 phy 0: RTL8201E 10/100 PHY, rev. 2
softraid0 at root
scsibus1 at softraid0: 256 targets
bootfile: sd0a:/bsd
boot device: sd0
root on rd0a swap on rd0b dump on rd0b
WARNING: CHECK AND RESET THE DATE!
gpio at bcmgpio0 not configured
bwfm0: failed loadfirmware of file brcmfmac43455-sdio.bin
erase ^?, werase ^W, kill ^U, intr ^C, status ^T

Welcome to the OpenBSD/arm64 6.8 installation program.
(I)nstall, (U)pgrade, (A)utoinstall or (S)hell? S

# dhclient ure0
ure0: 192.168.1.10 lease accepted from 192.168.1.1 (4c:ab:fc:31:0c:78)
# ping 114.114.114.114
PING 114.114.114.114 (114.114.114.114): 56 data bytes
64 bytes from 114.114.114.114: icmp_seq=0 ttl=68 time=131.735 ms
64 bytes from 114.114.114.114: icmp_seq=1 ttl=83 time=74.055 ms
^C
--- 114.114.114.114 ping statistics ---
2 packets transmitted, 2 packets received, 0.0% packet loss
round-trip min/avg/max/std-dev = 74.055/102.895/131.735/28.840 ms

# df -h
Filesystem Size Used Avail Capacity Mounted on
/dev/rd0a 7.7M 7.1M 614K 92% /

# install
At any prompt except password prompts you can escape to a shell by
typing '!'. Default answers are shown in []'s and are selected by
pressing RETURN. You can exit this program at any time by pressing
Control-C, but this can leave your system in an inconsistent state.

Terminal type? [vt220] xterm
System hostname? (short form, e.g. 'foo') openbsd-68

Available network interfaces are: bwfm0 ure0 vlan0.
Which network interface do you wish to configure? (or 'done') [bwfm0] ure0
IPv4 address for ure0? (or 'dhcp' or 'none') [192.168.1.10]
Netmask for ure0? [255.255.255.0]
IPv6 address for ure0? (or 'autoconf' or 'none') [none] autoconf
Available network interfaces are: bwfm0 ure0 vlan0.
Which network interface do you wish to configure? (or 'done') [done]
Default IPv4 route? (IPv4 address or none) 192.168.1.1
add net default: gateway 192.168.1.1
DNS domain name? (e.g. 'example.com') [my.domain]
DNS nameservers? (IP address list or 'none') [192.168.1.1]

Password for root account? (will not echo)
Password for root account? (again)
Start sshd(8) by default? [yes]
Setup a user? (enter a lower-case loginname, or 'no') [no]
Since no user was setup, root logins via sshd(8) might be useful.
WARNING: root is targeted by password guessing attacks, pubkeys are safer.
Allow root ssh login? (yes, no, prohibit-password) [no] yes

Available disks are: sd0.
Which disk is the root disk? ('?' for details) [sd0]
Disk: sd0 geometry: 7599/255/63 [122093568 Sectors]
Offset: 0 Signature: 0xAA55
Starting Ending LBA Info:
#: id C H S - C H S [ start: size ]
-------------------------------------------------------------------------------
*0: 0C 2 10 9 - 2 140 10 [ 32768: 8192 ] FAT32L
1: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused
2: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused
3: A6 2 140 11 - 4 52 48 [ 40960: 26624 ] OpenBSD
Use (W)hole disk or (E)dit the MBR? [whole] W
Creating a msdos partition and an OpenBSD partition for rest of sd0...done.
/dev/rsd0i: 32668 sectors in 8167 FAT16 clusters (2048 bytes/cluster)
bps=512 spc=4 res=1 nft=2 rde=512 mid=0xf8 spf=32 spt=63 hds=255 hid=32768 bsec=32768
The auto-allocated layout for sd0 is:
# size offset fstype [fsize bsize cpg]
a: 1024.0M 65536 4.2BSD 2048 16384 1 # /
b: 1170.2M 2162688 swap
c: 59616.0M 0 unused
d: 4024.1M 4559200 4.2BSD 2048 16384 1 # /tmp
e: 5924.3M 12800640 4.2BSD 2048 16384 1 # /var
f: 6144.0M 24933664 4.2BSD 2048 16384 1 # /usr
g: 1024.0M 37516576 4.2BSD 2048 16384 1 # /usr/X11R6
h: 8344.3M 39613728 4.2BSD 2048 16384 1 # /usr/local
i: 16.0M 32768 MSDOS
j: 2048.0M 56702816 4.2BSD 2048 16384 1 # /usr/src
k: 6144.0M 60897120 4.2BSD 2048 16384 1 # /usr/obj
l: 23737.1M 73480032 4.2BSD 2048 16384 1 # /home
Use (A)uto layout, (E)dit auto layout, or create (C)ustom layout? [a] E
Label editor (enter '?' for help at any prompt)
sd0> p
OpenBSD area: 65536-122093568; size: 122028032; free: 8
# size offset fstype [fsize bsize cpg]
a: 2097152 65536 4.2BSD 2048 16384 1 # /
b: 2396504 2162688 swap
c: 122093568 0 unused
d: 8241440 4559200 4.2BSD 2048 16384 1 # /tmp
e: 12133024 12800640 4.2BSD 2048 16384 1 # /var
f: 12582912 24933664 4.2BSD 2048 16384 1 # /usr
g: 2097152 37516576 4.2BSD 2048 16384 1 # /usr/X11R6
h: 17089088 39613728 4.2BSD 2048 16384 1 # /usr/local
i: 32768 32768 MSDOS
j: 4194304 56702816 4.2BSD 2048 16384 1 # /usr/src
k: 12582912 60897120 4.2BSD 2048 16384 1 # /usr/obj
l: 48613536 73480032 4.2BSD 2048 16384 1 # /home
sd0> d a
sd0*> d b
sd0*> d d
sd0*> d e
sd0*> d f
sd0*> d g
sd0*> d h
sd0*> d j
sd0*> d k
sd0*> d l
sd0*> p
OpenBSD area: 65536-122093568; size: 122028032; free: 122028032
# size offset fstype [fsize bsize cpg]
c: 122093568 0 unused
i: 32768 32768 MSDOS
sd0*> a b
offset: [65536]
size: [122028032] 2G
FS type: [swap]
sd0*> a a
offset: [4273290]
size: [117820278]
FS type: [4.2BSD]
mount point: [none] /
sd0*> p
OpenBSD area: 65536-122093568; size: 122028032; free: 22
# size offset fstype [fsize bsize cpg]
a: 117820256 4273312 4.2BSD 2048 16384 1 # /
b: 4207754 65536 swap
c: 122093568 0 unused
i: 32768 32768 MSDOS
sd0> quit
No label changes.
/dev/rsd0a: 57529.4MB in 117820256 sectors of 512 bytes
285 cylinder groups of 202.50MB, 12960 blocks, 25920 inodes each
/dev/sd0a (d11f67598186a9ba.a) on /mnt type ffs (rw, asynchronous, local)

Let's install the sets!
Location of sets? (disk http nfs or 'done') [http]
HTTP proxy URL? (e.g. 'http://proxy:8080', or 'none') [none]
(Unable to get list from ftp.openbsd.org, but that is OK)
HTTP Server? (hostname or 'done') 192.168.1.12
Server directory? [pub/OpenBSD/6.8/arm64]
Unable to connect using https. Use http instead? [no] yes

Select sets by entering a set name, a file name pattern or 'all'. De-select
sets by prepending a '-', e.g.: '-game*'. Selected sets are labelled '[X]'.
[X] bsd [X] base68.tgz [X] game68.tgz [X] xfont68.tgz
[X] bsd.mp [X] comp68.tgz [X] xbase68.tgz [X] xserv68.tgz
[X] bsd.rd [X] man68.tgz [X] xshare68.tgz
Set name(s)? (or 'abort' or 'done') [done]
Get/Verify SHA256.sig 100% |**************************| 1454 00:00
Signature Verified
Get/Verify bsd 100% |**************************| 13017 KB 00:05
Get/Verify bsd.mp 100% |**************************| 13082 KB 00:04
Get/Verify bsd.rd 100% |**************************| 12669 KB 00:04
Get/Verify base68.tgz 100% |**************************| 216 MB 01:00
Get/Verify comp68.tgz 100% |**************************| 53375 KB 00:14
Get/Verify man68.tgz 100% |**************************| 7484 KB 00:02
Get/Verify game68.tgz 100% |**************************| 2677 KB 00:01
Get/Verify xbase68.tgz 100% |**************************| 24967 KB 00:07
Get/Verify xshare68.tgz 100% |**************************| 4500 KB 00:01
Get/Verify xfont68.tgz 100% |**************************| 39344 KB 00:12
Get/Verify xserv68.tgz 100% |**************************| 10943 KB 00:03
Installing bsd 100% |**************************| 13017 KB 00:02
Installing bsd.mp 100% |**************************| 13082 KB 00:02
Installing bsd.rd 100% |**************************| 12669 KB 00:02
Installing base68.tgz 100% |**************************| 216 MB 01:40
Extracting etc.tgz 100% |**************************| 260 KB 00:00
Installing comp68.tgz 100% |**************************| 53375 KB 00:45
Installing man68.tgz 100% |**************************| 7484 KB 00:08
Installing game68.tgz 100% |**************************| 2677 KB 00:01
Installing xbase68.tgz 100% |**************************| 24967 KB 00:18
Extracting xetc.tgz 100% |**************************| 7068 00:00
Installing xshare68.tgz 100% |**************************| 4500 KB 00:09
Installing xfont68.tgz 100% |**************************| 39344 KB 00:20
Installing xserv68.tgz 100% |**************************| 10943 KB 00:06
Location of sets? (disk http nfs or 'done') [done]

What timezone are you in? ('?' for list) [Canada/Mountain] ?
Africa/ Chile/ GB-Eire Israel Navajo US/
America/ Cuba GMT Jamaica PRC UTC
Antarctica/ EET GMT+0 Japan PST8PDT Universal
Arctic/ EST GMT-0 Kwajalein Pacific/ W-SU
Asia/ EST5EDT GMT0 Libya Poland WET
Atlantic/ Egypt Greenwich MET Portugal Zulu
Australia/ Eire HST MST ROC posixrules
Brazil/ Etc/ Hongkong MST7MDT ROK
CET Europe/ Iceland Mexico/ Singapore
CST6CDT Factory Indian/ NZ Turkey
Canada/ GB Iran NZ-CHAT UCT
What timezone are you in? ('?' for list) [Canada/Mountain] Asia
What sub-timezone of 'Asia' are you in? ('?' for list) ?
Aden Chongqing Jerusalem Novokuznetsk Tashkent
Almaty Chungking Kabul Novosibirsk Tbilisi
Amman Colombo Kamchatka Omsk Tehran
Anadyr Dacca Karachi Oral Tel_Aviv
Aqtau Damascus Kashgar Phnom_Penh Thimbu
Aqtobe Dhaka Kathmandu Pontianak Thimphu
Ashgabat Dili Katmandu Pyongyang Tokyo
Ashkhabad Dubai Khandyga Qatar Tomsk
Atyrau Dushanbe Kolkata Qostanay Ujung_Pandang
Baghdad Famagusta Krasnoyarsk Qyzylorda Ulaanbaatar
Bahrain Gaza Kuala_Lumpur Rangoon Ulan_Bator
Baku Harbin Kuching Riyadh Urumqi
Bangkok Hebron Kuwait Saigon Ust-Nera
Barnaul Ho_Chi_Minh Macao Sakhalin Vientiane
Beirut Hong_Kong Macau Samarkand Vladivostok
Bishkek Hovd Magadan Seoul Yakutsk
Brunei Irkutsk Makassar Shanghai Yangon
Calcutta Istanbul Manila Singapore Yekaterinburg
Chita Jakarta Muscat Srednekolymsk Yerevan
Choibalsan Jayapura Nicosia Taipei
What sub-timezone of 'Asia' are you in? ('?' for list) Shanghai
Saving configuration files... done.
Making all device nodes... done.
Multiprocessor machine; using bsd.mp instead of bsd.
Relinking to create unique kernel... done.

CONGRATULATIONS! Your OpenBSD install has been successfully completed!

When you login to your new system the first time, please read your mail
using the 'mail' command.

Exit to (S)hell, (H)alt or (R)eboot? [reboot]
syncing disks... done
rebooting...
+ +

First boot

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171

U-Boot 2020.07 (Sep 13 2020 - 13:13:43 -0600)

DRAM: 948 MiB
RPI 3 Model B+ (0xa020d3)
MMC: mmc@7e202000: 0, mmcnr@7e300000: 1
Loading Environment from FAT... *** Warning - bad CRC, using default environment

In: serial
Out: vidconsole
Err: vidconsole
Net: No ethernet found.
starting USB...
Bus usb@7e980000: USB DWC2
scanning bus usb@7e980000 for devices... 6 USB Device(s) found
scanning usb for storage devices... 0 Storage Device(s) found
Hit any key to stop autoboot: 0
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
Found EFI removable media binary efi/boot/bootaa64.efi
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
Scanning disk mmc@7e202000.blk...
** Unrecognized filesystem type **
Card did not respond to voltage select!
Scanning disk mmcnr@7e300000.blk...
Disk mmcnr@7e300000.blk not ready
Found 3 disks
BootOrder not defined
EFI boot manager: Cannot load any image
168696 bytes read in 11 ms (14.6 MiB/s)
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
disks: sd0*
>> OpenBSD/arm64 BOOTAA64 1.2
boot>
booting sd0a:/bsd: 8626252+1764264+552000+797952 [624213+109+1051200+616512]=0xf79648
type 0x0 pa 0x0 va 0x0 pages 0x1 attr 0x8
type 0x7 pa 0x1000 va 0x1000 pages 0x1ff attr 0x8
type 0x2 pa 0x200000 va 0x200000 pages 0x4000 attr 0x8
type 0x7 pa 0x4200000 va 0x4200000 pages 0x3cf5 attr 0x8
type 0x9 pa 0x7ef5000 va 0x7ef5000 pages 0x16 attr 0x8
type 0x7 pa 0x7f0b000 va 0x7f0b000 pages 0x31214 attr 0x8
type 0x2 pa 0x3911f000 va 0x3911f000 pages 0xce7 attr 0x8
type 0x4 pa 0x39e06000 va 0x39e06000 pages 0x1 attr 0x8
type 0x2 pa 0x39e07000 va 0x39e07000 pages 0x3 attr 0x8
type 0x7 pa 0x39e0a000 va 0x39e0a000 pages 0x1 attr 0x8
type 0x2 pa 0x39e0b000 va 0x39e0b000 pages 0x100 attr 0x8
type 0x1 pa 0x39f0b000 va 0x39f0b000 pages 0x2a attr 0x8
type 0x0 pa 0x39f35000 va 0x39f35000 pages 0x7 attr 0x8
type 0x4 pa 0x39f3c000 va 0x39f3c000 pages 0x1 attr 0x8
type 0x6 pa 0x39f3d000 va 0x3071b4a000 pages 0x1 attr 0x8000000000000008
type 0x4 pa 0x39f3e000 va 0x39f3e000 pages 0x2 attr 0x8
type 0x0 pa 0x39f40000 va 0x39f40000 pages 0x1 attr 0x8
type 0x4 pa 0x39f41000 va 0x39f41000 pages 0x2 attr 0x8
type 0x6 pa 0x39f43000 va 0x3071b50000 pages 0x2 attr 0x8000000000000008
type 0x0 pa 0x39f45000 va 0x39f45000 pages 0x1 attr 0x8
type 0x4 pa 0x39f46000 va 0x39f46000 pages 0x1 attr 0x8
type 0x0 pa 0x39f47000 va 0x39f47000 pages 0x1 attr 0x8
type 0x4 pa 0x39f48000 va 0x39f48000 pages 0x2 attr 0x8
type 0x0 pa 0x39f4a000 va 0x39f4a000 pages 0x1 attr 0x8
type 0x2 pa 0x39f4b000 va 0x39f4b000 pages 0x1405 attr 0x8
type 0x5 pa 0x3b350000 va 0x3072f5d000 pages 0x10 attr 0x8000000000000008
type 0x2 pa 0x3b360000 va 0x3b360000 pages 0xa0 attr 0x8
type 0xb pa 0x3f100000 va 0x3072f6d000 pages 0x1 attr 0x8000000000000000
[ using 2293000 bytes of bsd ELF symbol table ]
Copyright (c) 1982, 1986, 1989, 1991, 1993
The Regents of the University of California. All rights reserved.
Copyright (c) 1995-2020 OpenBSD. All rights reserved. https://www.OpenBSD.org

OpenBSD 6.8 (GENERIC.MP) #828: Sun Oct 4 20:35:47 MDT 2020
deraadt@arm64.openbsd.org:/usr/src/sys/arch/arm64/compile/GENERIC.MP
real mem = 957382656 (913MB)
avail mem = 895623168 (854MB)
random: good seed from bootblocks
mainbus0 at root: Raspberry Pi 3 Model B Plus Rev 1.3
cpu0 at mainbus0 mpidr 0: ARM Cortex-A53 r0p4
cpu0: 32KB 64b/line 2-way L1 VIPT I-cache, 32KB 64b/line 4-way L1 D-cache
cpu0: 512KB 64b/line 16-way L2 cache
cpu1 at mainbus0 mpidr 1: ARM Cortex-A53 r0p4
cpu1: 32KB 64b/line 2-way L1 VIPT I-cache, 32KB 64b/line 4-way L1 D-cache
cpu1: 512KB 64b/line 16-way L2 cache
cpu2 at mainbus0 mpidr 2: ARM Cortex-A53 r0p4
cpu2: 32KB 64b/line 2-way L1 VIPT I-cache, 32KB 64b/line 4-way L1 D-cache
cpu2: 512KB 64b/line 16-way L2 cache
cpu3 at mainbus0 mpidr 3: ARM Cortex-A53 r0p4
cpu3: 32KB 64b/line 2-way L1 VIPT I-cache, 32KB 64b/line 4-way L1 D-cache
cpu3: 512KB 64b/line 16-way L2 cache
efi0 at mainbus0: UEFI 2.8
efi0: Das U-Boot rev 0x20200700
apm0 at mainbus0
simplefb0 at mainbus0: 1824x984, 32bpp
wsdisplay0 at simplefb0 mux 1
wsdisplay0: screen 0-5 added (std, vt100 emulation)
"system" at mainbus0 not configured
"axi" at mainbus0 not configured
simplebus0 at mainbus0: "soc"
bcmclock0 at simplebus0
bcmmbox0 at simplebus0
bcmgpio0 at simplebus0
bcmaux0 at simplebus0
bcmdmac0 at simplebus0: DMA0 DMA2 DMA4 DMA5 DMA8 DMA9 DMA10
bcmintc0 at simplebus0
bcmrng0 at simplebus0
pluart0 at simplebus0: console
bcmsdhost0 at simplebus0: 250 MHz base clock
sdmmc0 at bcmsdhost0: 4-bit, sd high-speed, mmc high-speed, dma
dwctwo0 at simplebus0
bcmdog0 at simplebus0
bcmtemp0 at simplebus0
"local_intc" at simplebus0 not configured
sdhc0 at simplebus0
sdhc0: SDHC 3.0, 200 MHz base clock
sdmmc1 at sdhc0: 4-bit, sd high-speed, mmc high-speed
simplebus1 at simplebus0: "firmware"
"clocks" at simplebus1 not configured
"expgpio" at simplebus1 not configured
"power" at simplebus0 not configured
"mailbox" at simplebus0 not configured
"gpiomem" at simplebus0 not configured
"fb" at simplebus0 not configured
"vcsm" at simplebus0 not configured
"clocks" at mainbus0 not configured
"phy" at mainbus0 not configured
"arm-pmu" at mainbus0 not configured
agtimer0 at mainbus0: tick rate 19200 KHz
"leds" at mainbus0 not configured
"fixedregulator_3v3" at mainbus0 not configured
"fixedregulator_5v0" at mainbus0 not configured
usb0 at dwctwo0: USB revision 2.0
scsibus0 at sdmmc0: 2 targets, initiator 0
sd0 at scsibus0 targ 1 lun 0: <SD/MMC, SD64G, 0060> removable
sd0: 59616MB, 512 bytes/sector, 122093568 sectors
uhub0 at usb0 configuration 1 interface 0 "Broadcom DWC2 root hub" rev 2.00/1.00 addr 1
uhub1 at uhub0 port 1 configuration 1 interface 0 "Standard Microsystems product 0x2514" rev 2.00/b.b3 addr 2
bwfm0 at sdmmc1 function 1
manufacturer 0x02d0, product 0xa9a6 at sdmmc1 function 2 not configured
manufacturer 0x02d0, product 0xa9a6 at sdmmc1 function 3 not configured
uhub2 at uhub1 port 1 configuration 1 interface 0 "Standard Microsystems product 0x2514" rev 2.00/b.b3 addr 3
uhub3 at uhub2 port 3 configuration 1 interface 0 "vendor 0x214b USB2.0 HUB" rev 2.00/1.00 addr 4
ure0 at uhub3 port 1 configuration 1 interface 0 "Realtek USB 10/100 LAN" rev 2.10/20.00 addr 5
ure0: RTL8152 (0x4c10), address 00:e0:4c:36:03:b4
rlphy0 at ure0 phy 0: RTL8201E 10/100 PHY, rev. 2
vscsi0 at root
scsibus1 at vscsi0: 256 targets
softraid0 at root
scsibus2 at softraid0: 256 targets
bootfile: sd0a:/bsd
boot device: sd0
root on sd0a (d11f67598186a9ba.a) swap on sd0b dump on sd0b
WARNING: CHECK AND RESET THE DATE!
gpio0 at bcmgpio0: 54 pins
bwfm0: failed loadfirmware of file brcmfmac43455-sdio.bin
Automatic boot in progress: starting file system checks.
/dev/sd0a (d11f67598186a9ba.a): file system is clean; not checking
pf enabled
starting network
reordering libraries: done.
openssl: generating isakmpd/iked RSA keys... done.
ssh-keygen: generating new host keys: RSA DSA ECDSA ED25519
starting early daemons: syslogd pflogd ntpd.
starting RPC daemons:.
savecore: no core dump
checking quotas: done.
clearing /tmp
kern.securelevel: 0 -> 1
creating runtime link editor directory cache.
preserving editor files.
starting network daemons: sshd smtpd sndiod.
running rc.firsttime
Path to firmware: http://firmware.openbsd.org/firmware/6.8/
Installing: bwfm-firmware
+ +

Logging in to OpenBSD

You must log in with the account created during system installation.

+

System characteristics

uname

1
2
3
4
5
# uname -snrmp
OpenBSD openbsd-68.my.domain 6.8 arm64 aarch64

# uname -a
OpenBSD openbsd-68.my.domain 6.8 GENERIC.MP#828 arm64
+ +

cpu

1
2
3
4
5
6
7
8
9
10
11
12
13
# dmesg | grep cpu
cpu0 at mainbus0 mpidr 0: ARM Cortex-A53 r0p4
cpu0: 32KB 64b/line 2-way L1 VIPT I-cache, 32KB 64b/line 4-way L1 D-cache
cpu0: 512KB 64b/line 16-way L2 cache
cpu1 at mainbus0 mpidr 1: ARM Cortex-A53 r0p4
cpu1: 32KB 64b/line 2-way L1 VIPT I-cache, 32KB 64b/line 4-way L1 D-cache
cpu1: 512KB 64b/line 16-way L2 cache
cpu2 at mainbus0 mpidr 2: ARM Cortex-A53 r0p4
cpu2: 32KB 64b/line 2-way L1 VIPT I-cache, 32KB 64b/line 4-way L1 D-cache
cpu2: 512KB 64b/line 16-way L2 cache
cpu3 at mainbus0 mpidr 3: ARM Cortex-A53 r0p4
cpu3: 32KB 64b/line 2-way L1 VIPT I-cache, 32KB 64b/line 4-way L1 D-cache
cpu3: 512KB 64b/line 16-way L2 cache
+ +

memory

1
2
3
# dmesg | grep -i mem
real mem = 957382656 (913MB)
avail mem = 895623168 (854MB)
+ +

ure

Realtek RTL8152 Based USB Ethernet Adapter

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# dmesg | grep ure0
ure0 at uhub3 port 1 configuration 1 interface 0 "Realtek USB 10/100 LAN" rev 2.10/20.00 addr 5
ure0: RTL8152 (0x4c10), address 00:e0:4c:36:03:b4
rlphy0 at ure0 phy 0: RTL8201E 10/100 PHY, rev. 2

# dmesg | grep bwfm0
bwfm0 at sdmmc1 function 1
bwfm0: failed loadfirmware of file brcmfmac43455-sdio.bin

# dmesg | grep uhub
uhub0 at usb0 configuration 1 interface 0 "Broadcom DWC2 root hub" rev 2.00/1.00 addr 1
uhub1 at uhub0 port 1 configuration 1 interface 0 "Standard Microsystems product 0x2514" rev 2.00/b.b3 addr 2
uhub2 at uhub1 port 1 configuration 1 interface 0 "Standard Microsystems product 0x2514" rev 2.00/b.b3 addr 3
uhub3 at uhub2 port 3 configuration 1 interface 0 "vendor 0x214b USB2.0 HUB" rev 2.00/1.00 addr 4
ure0 at uhub3 port 1 configuration 1 interface 0 "Realtek USB 10/100 LAN" rev 2.10/20.00 addr 5
+ +

sysctl

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# sysctl | grep ^hw
hw.machine=arm64
hw.model=ARM Cortex-A53 r0p4
hw.ncpu=4
hw.byteorder=1234
hw.pagesize=4096
hw.disknames=sd0:d11f67598186a9ba
hw.diskcount=1
hw.sensors.bcmtemp0.temp0=40.78 degC
hw.product=Raspberry Pi 3 Model B Plus Rev 1.3
hw.serialno=0000000066661338
hw.physmem=957382656
hw.usermem=957366272
hw.ncpufound=4
hw.allowpowerdown=1
hw.ncpuonline=4

kern.clockrate=tick = 10000, tickadj = 40, hz = 100, profhz = 1000, stathz = 100
kern.consbufsize=16344
kern.consdev=tty00
kern.fscale=2048
kern.fsync=1
kern.maxclusters=65536
kern.maxfiles=7030
kern.maxlocksperuid=1024
kern.maxpartitions=16
kern.maxproc=1310
kern.maxthread=1950
kern.maxvnodes=10920
kern.numvnodes=4570
kern.osrelease=6.8
kern.osrevision=202010
kern.ostype=OpenBSD
kern.osversion=GENERIC.MP#828
kern.timecounter.choice=agtimer(0)
kern.timecounter.hardware=agtimer
kern.timecounter.tick=1
kern.timecounter.timestepwarnings=0
kern.timeout_stats=added = 203712, cancelled = 106901, deleted = 131218, late = 15, pending = 31, readded = 8987, scheduled = 105962, rescheduled = 923, run_softclock = 69066, run_thread = 18727, softclocks = 126713, thread_wakeups = 16364
kern.tty.tk_cancc=9
kern.tty.tk_nin=559
kern.tty.tk_nout=61410
kern.tty.tk_rawcc=550
kern.ttycount=8
kern.utc_offset=0
kern.version=OpenBSD 6.8 (GENERIC.MP) #828: Sun Oct 4 20:35:47 MDT 2020
kern.watchdog.auto=1
kern.watchdog.period=0
kern.wxabort=0

machdep.compatible=raspberrypi,3-model-b-plus

net.inet.carp.allow=1
net.inet.carp.log=2
net.inet.carp.preempt=0

net.mpls.mapttl_ip6=0
net.mpls.mapttl_ip=1
net.mpls.ttl=255

vm.swapencrypt.enable=1
vm.swapencrypt.keyscreated=0
vm.swapencrypt.keysdeleted=0
+ +

mmc

1
2
3
4
5
6
7
# dmesg | grep mmc
sdmmc0 at bcmsdhost0: 4-bit, sd high-speed, mmc high-speed, dma
sdmmc1 at sdhc0: 4-bit, sd high-speed, mmc high-speed
scsibus0 at sdmmc0: 2 targets, initiator 0
bwfm0 at sdmmc1 function 1
manufacturer 0x02d0, product 0xa9a6 at sdmmc1 function 2 not configured
manufacturer 0x02d0, product 0xa9a6 at sdmmc1 function 3 not configured
+ +

mounts

1
2
3
4
5
6
# mount
/dev/sd0a on / type ffs (local, wxallowed)

# df -h
Filesystem Size Used Avail Capacity Mounted on
/dev/sd0a 54.4G 1.1G 50.6G 2% /
+ +

fdisk

1
2
3
4
5
6
7
8
9
10
# fdisk /dev/rsd0c
Disk: /dev/rsd0c geometry: 7599/255/63 [122093568 Sectors]
Offset: 0 Signature: 0xAA55
Starting Ending LBA Info:
#: id C H S - C H S [ start: size ]
-------------------------------------------------------------------------------
*0: 0C 2 10 9 - 4 20 16 [ 32768: 32768 ] FAT32L
1: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused
2: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused
3: A6 4 20 17 - 7599 248 9 [ 65536: 122028032 ] OpenBSD
+ +

disklabel

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# disklabel /dev/rsd0c
# /dev/rsd0c:
type: SCSI
disk: SCSI disk
label: SD/MMC SD64G
duid: d11f67598186a9ba
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 255
sectors/cylinder: 16065
cylinders: 7599
total sectors: 122093568
boundstart: 65536
boundend: 122093568
drivedata: 0

16 partitions:
# size offset fstype [fsize bsize cpg]
a: 117820256 4273312 4.2BSD 2048 16384 12960 # /
b: 4207754 65536 swap # none
c: 122093568 0 unused
i: 32768 32768 MSDOS
+ +

List of processes after startup

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# ps -Auww
# ps -Avww
# ps -Alww
UID PID PPID CPU PRI NI VSZ RSS WCHAN STAT TT TIME COMMAND
0 1 0 22 10 0 424 296 wait I ?? 0:01.03 /sbin/init
0 40766 1 0 2 0 728 524 kqread Ip ?? 0:00.03 /sbin/slaacd
115 17592 40766 0 2 0 748 636 kqread Ip ?? 0:00.04 slaacd: engine (slaacd)
115 77135 40766 0 2 0 760 628 kqread Ip ?? 0:00.20 slaacd: frontend (slaacd)
0 7309 1 20 2 0 532 2064 netio IpU ?? 0:00.06 syslogd: [priv] (syslogd)
73 77649 7309 0 2 0 1060 1288 kqread Sp ?? 0:00.20 /usr/sbin/syslogd
0 7362 1 20 2 0 716 476 netio IU ?? 0:00.15 pflogd: [priv] (pflogd)
74 1735 7362 0 4 0 752 428 bpf Sp ?? 0:00.34 pflogd: [running] -s 160 -i pflog0 -f /var/log/pflog (pflogd)
83 29117 1 0 2 -20 1032 2660 poll S<p ?? 0:00.26 ntpd: ntp engine (ntpd)
83 2803 29117 0 2 0 840 2316 poll Ip ?? 0:00.28 ntpd: dns engine (ntpd)
0 16607 1 0 2 -20 780 1456 poll I<pU ?? 0:00.09 /usr/sbin/ntpd
0 97076 1 0 2 0 1020 1284 select S ?? 0:00.02 sshd: /usr/sbin/sshd [listener] 0 of 10-100 startups (sshd)
0 28535 1 0 2 0 1564 1976 kqread Ip ?? 0:00.10 /usr/sbin/smtpd
95 85245 28535 11 2 0 1300 3564 kqread Ip ?? 0:00.26 smtpd: klondike (smtpd)
95 42581 28535 0 2 0 1640 3936 kqread Ip ?? 0:00.21 smtpd: control (smtpd)
95 71786 28535 0 2 0 1420 3804 kqread Ip ?? 0:00.16 smtpd: lookup (smtpd)
95 11403 28535 0 2 0 1720 4164 kqread Ip ?? 0:00.25 smtpd: pony express (smtpd)
103 60517 28535 0 2 0 1524 3848 kqread Ip ?? 0:00.22 smtpd: queue (smtpd)
95 88138 28535 0 2 0 1296 3640 kqread Ip ?? 0:00.16 smtpd: scheduler (smtpd)
110 33178 1 20 2 0 500 820 poll IpU ?? 0:00.07 sndiod: helper (sndiod)
99 31324 1 20 2 -20 516 660 poll I<p ?? 0:00.02 /usr/bin/sndiod
0 44354 1 0 2 0 672 1152 poll Sp ?? 0:00.03 /usr/sbin/cron
0 38283 1 0 18 0 812 680 pause Sp 00 0:00.11 -ksh (ksh)
0 71343 38283 0 28 0 444 356 - R+pU/0 00 0:00.00 ps -Alww
0 6050 1 0 3 0 308 1100 ttyin I+pU C1 0:00.05 /usr/libexec/getty std.9600 ttyC1
0 43052 1 0 3 0 308 1092 ttyin I+pU C2 0:00.04 /usr/libexec/getty std.9600 ttyC2
0 22185 1 0 3 0 316 1100 ttyin I+pU C3 0:00.04 /usr/libexec/getty std.9600 ttyC3
0 89374 1 0 3 0 316 1096 ttyin I+pU C5 0:00.02 /usr/libexec/getty std.9600 ttyC5
+ +

ifconfig

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# ifconfig -a
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 32768
index 2 priority 0 llprio 3
groups: lo
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
inet 127.0.0.1 netmask 0xff000000
enc0: flags=0<>
index 1 priority 0 llprio 3
groups: enc
status: active
bwfm0: flags=808803<UP,BROADCAST,SIMPLEX,MULTICAST,AUTOCONF4> mtu 1500
lladdr 00:00:00:00:00:00
index 3 priority 4 llprio 3
groups: wlan
media: IEEE802.11 autoselect
status: no network
ieee80211: nwid ""
ure0: flags=208843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,AUTOCONF6> mtu 1500
lladdr 00:e0:4c:36:03:b4
index 4 priority 0 llprio 3
groups: egress
media: Ethernet autoselect (100baseTX full-duplex)
status: active
inet 192.168.1.10 netmask 0xffffff00 broadcast 192.168.1.255
inet6 fe80::2e0:4cff:fe36:3b4%ure0 prefixlen 64 scopeid 0x4
inet6 2409:8a55:8b5:6740:46b4:f79:f201:a029 prefixlen 64 autoconf pltime 100090 vltime 186490
inet6 2409:8a55:8b5:6740:6b9d:19d2:39a3:ce40 prefixlen 64 autoconf autoconfprivacy pltime 85537 vltime 172011
pflog0: flags=141<UP,RUNNING,PROMISC> mtu 33136
index 5 priority 0 llprio 3
groups: pflog
+ +

Compiler

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# ld -v
LLD 10.0.1 (compatible with GNU linkers)

# cc -v
OpenBSD clang version 10.0.1
Target: aarch64-unknown-openbsd6.8
Thread model: posix
InstalledDir: /usr/bin

# c++ -v
OpenBSD clang version 10.0.1
Target: aarch64-unknown-openbsd6.8
Thread model: posix
InstalledDir: /usr/bin

# file sh
sh: ELF 64-bit LSB shared object, AArch64, version 1

# ldd sh
sh:
Start End Type Open Ref GrpRef Name
0000001e95ddc000 0000001e95ea1000 dlib 1 0 0 /bin/sh

# file /usr/bin/cc
/usr/bin/cc: ELF 64-bit LSB executable, AArch64, version 1

# ldd /usr/bin/cc
/usr/bin/cc:
Start End Type Open Ref GrpRef Name
0000000000200000 000000000382b000 exe 2 0 0 /usr/bin/cc
000000047f890000 000000047f991000 rlib 0 1 0 /usr/lib/libc++.so.5.0
000000046d67c000 000000046d6e7000 rlib 0 2 0 /usr/lib/libc++abi.so.3.0
000000043d02b000 000000043d063000 rlib 0 1 0 /usr/lib/libpthread.so.26.1
000000043012e000 0000000430193000 rlib 0 1 0 /usr/lib/libm.so.10.1
00000004248bd000 00000004249c3000 rlib 0 1 0 /usr/lib/libc.so.96.0
0000000457850000 0000000457850000 ld.so 0 1 0 /usr/libexec/ld.so
+ +

OpenBSD Ports

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# fw_update -iv
Path to firmware: http://firmware.openbsd.org/firmware/6.8/
Installed: bwfm-firmware-20200316.1.2

# shutdown -r now

# find /etc/firmware/ | grep 43455
/etc/firmware/brcmfmac43455-sdio.bin
/etc/firmware/brcmfmac43455-sdio.raspberrypi,4-model-b.txt
/etc/firmware/brcmfmac43455-sdio.MINIX-NEO Z83-4.txt
/etc/firmware/brcmfmac43455-sdio.raspberrypi,3-model-b-plus.txt

# dmesg | grep bwfm
bwfm0 at sdmmc1 function 1
bwfm_sdio_buf_write: error 60
bwfm0: could not load microcode
bwfm0: HT avail timeout
bwfm_sdio_buf_write: error 60
bwfm0: could not load microcode
bwfm0: could not init bus

# export PKG_PATH=scp://user@company-build-server/usr/ports/packages/%a/all:https://trusted-public-server/%m:installpath

# cat /etc/installurl
#http://192.168.1.12/pub/OpenBSD
https://cdn.openbsd.org/pub/OpenBSD

$ pkg_info -Q unzip
# pkg_add -UVv rsync xz curl
# pkg_add -uVv unzip

# pkg_info
bwfm-firmware-20200316.1.2 firmware binary images for bwfm(4) driver
curl-7.72.0 transfer files with FTP, HTTP, HTTPS, etc.
nghttp2-1.41.0p1 library for HTTP/2
quirks-3.440 exceptions to pkg_add rules
rsync-3.2.3 mirroring/synchronization over low bandwidth links
xz-5.2.5 LZMA compression and decompression tools

$ pkg_info -mz | tee list
# pkg_add -l list
+ +

Conclusion

OpenBSD 6.8 arm64 can use my Realtek RTL8152 Based USB Ethernet Adapter, it’s works very good. But is can’t found the Ethernet Adapterin Raspberry Pi 3 Model B Plus Rev 1.3, and the WiFi Adapter after firmware installation, it’s really disappointing.

+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/12/05/ubuntu-20-04-arm64-on-raspberry-pi-3b/index.html b/2020/12/05/ubuntu-20-04-arm64-on-raspberry-pi-3b/index.html new file mode 100644 index 00000000..6d5fb1e0 --- /dev/null +++ b/2020/12/05/ubuntu-20-04-arm64-on-raspberry-pi-3b/index.html @@ -0,0 +1,289 @@ + + + + + + + + + + + + Ubuntu 20.04 arm64 on Raspberry Pi 3B+ | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Ubuntu 20.04 arm64 on Raspberry Pi 3B+ +

+ +

Ubuntu 20.04 arm64 on Raspberry Pi 3B+

Download Ubuntu image

Reference

+

Download command

1
2
3
4
$ cat << EOF | aria2c -i -
https://cdimage.ubuntu.com/releases/20.04.1/release/ubuntu-20.04.1-preinstalled-server-armhf+raspi.img.xz
https://cdimage.ubuntu.com/releases/20.04.1/release/ubuntu-20.04.1-preinstalled-server-arm64+raspi.img.xz
EOF
+ +

Integrity check

1
2
3
4
cat << EOF | sha256sum -c
aadc64a1d069c842e56a4289fe1a6b4b5a0af4efcf95bcce78eb2a80fe5270f4 ubuntu-20.04.1-preinstalled-server-arm64+raspi.img.xz
bfd1eee56f7e346e1645666fc184af854c536b3ab4e1ce49d06c266f21b1ee46 ubuntu-20.04.1-preinstalled-server-armhf+raspi.img.xz
EOF
+ +

Write image to MicroSD card

MicroSD card

1
2
3
4
$ dmesg -w
[ 0.621922] mmc0: SDHCI controller on PCI [0000:03:00.0] using ADMA
[ 0.851733] mmc0: new high speed SDXC card at address 5048
[ 0.853303] mmcblk0: mmc0:5048 SD64G 58.2 GiB
+ +

Write image

1
2
3
4
5
6
$ cat ubuntu-20.04.1-preinstalled-server-arm64+raspi.img.xz \
| xz -cd \
| sudo /usr/bin/time -f "\nreal\t%es\nuser\t%Us\nsys\t%Ss\n" dd of=/dev/mmcblk0 bs=4M oflag=sync status=progress
0+49663 records in
0+49663 records out
3250824192 bytes (3.3 GB, 3.0 GiB) copied, 289.182 s, 11.2 MB/s
+ +

parted

1
2
3
4
5
6
7
8
9
10
11
12
13
14
$ sudo partprobe /dev/mmcblk0

$ sudo partx -uv /dev/mmcblk0

$ sudo parted /dev/mmcblk0 print
Model: SD SD64G (sd/mmc)
Disk /dev/mmcblk0: 62.5GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number Start End Size Type File system Flags
1 1049kB 269MB 268MB primary fat32 boot, lba
2 269MB 3251MB 2981MB primary ext4
+ +

gdisk

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
$ sudo gdisk -l /dev/mmcblk0 2>/dev/null
GPT fdisk (gdisk) version 1.0.5

Partition table scan:
MBR: MBR only
BSD: not present
APM: not present
GPT: not present


***************************************************************
Found invalid GPT and valid MBR; converting MBR to GPT format
in memory.
***************************************************************

Disk /dev/mmcblk0: 122093568 sectors, 58.2 GiB
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): 192B2178-C964-40D4-B213-7711265FEC24
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 122093534
Partitions will be aligned on 2048-sector boundaries
Total free space is 115746317 sectors (55.2 GiB)

Number Start (sector) End (sector) Size Code Name
1 2048 526335 256.0 MiB 0700 Microsoft basic data
2 526336 6349231 2.8 GiB 8300 Linux filesystem
+ +

fdisk

1
2
3
4
5
6
7
8
9
10
11
$ sudo fdisk -l /dev/mmcblk0
Disk /dev/mmcblk0: 58.22 GiB, 62511906816 bytes, 122093568 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xab86aefd

Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 * 2048 526335 524288 256M c W95 FAT32 (LBA)
/dev/mmcblk0p2 526336 6349231 5822896 2.8G 83 Linux
+ +

filesystem label

1
2
3
4
5
6
7
8
9
10
11
12
$ sudo fsck.vfat -a /dev/mmcblk0p1
fsck.fat 4.1 (2017-01-24)
/dev/mmcblk0p1: 237 files, 121131/516190 clusters

$ sudo dosfslabel /dev/mmcblk0p1
system-boot

$ sudo e2fsck -p /dev/mmcblk0p2
writable: clean, 74810/182160 files, 488817/727862 blocks

$ sudo e2label /dev/mmcblk0p2
writable
+ +

mmcblk

1
2
3
4
5
$ dmesg -w
[ 5632.885061] mmc0: new high speed SDXC card at address 5048
[ 5632.885363] mmcblk0: mmc0:5048 SD64G 58.2 GiB
[ 5632.909619] mmcblk0: p1 p2
[ 5633.244337] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
+ +

blkid

1
2
3
4
$ sudo blkid --info /dev/mmcblk0*
/dev/mmcblk0: MINIMUM_IO_SIZE="512" PHYSICAL_SECTOR_SIZE="512" LOGICAL_SECTOR_SIZE="512"
/dev/mmcblk0p1: MINIMUM_IO_SIZE="512" PHYSICAL_SECTOR_SIZE="512" LOGICAL_SECTOR_SIZE="512"
/dev/mmcblk0p2: MINIMUM_IO_SIZE="512" PHYSICAL_SECTOR_SIZE="512" LOGICAL_SECTOR_SIZE="512"
+ +

df

1
2
3
4
$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mmcblk0p2 2.7G 1.8G 776M 70% /media/dongsheng/writable
/dev/mmcblk0p1 253M 60M 193M 24% /media/dongsheng/system-boot
+ +

Boot configuration

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
$ cat /boot/firmware/cmdline.txt
net.ifnames=0 dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=LABEL=writable rootfstype=ext4 rootwait fixrtc earlycon=pl011,mmio32,0x3f201000

$ cat /boot/firmware/config.txt
[all]
arm_64bit=1
kernel=vmlinuz
cmdline=cmdline.txt
initramfs initrd.img followkernel

# Enable the audio output, I2C and SPI interfaces on the GPIO header
dtparam=audio=on
dtparam=i2c_arm=on
dtparam=spi=on

# Enable the serial pins
enable_uart=1
#dtoverlay=disable-bt
dtoverlay=miniuart-bt
core_freq=400
+ +

UART with USB-TTL

Pin Connectors

Raspberry Pi 3 B+ Pins

+

dmesg

1
2
3
4
5
6
7
8
9
10
11
$ dmesg -w
[ 7483.528344] usb 2-2: new full-speed USB device number 4 using xhci_hcd
[ 7483.685373] usb 2-2: New USB device found, idVendor=1a86, idProduct=7523, bcdDevice= 2.64
[ 7483.685378] usb 2-2: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[ 7483.685380] usb 2-2: Product: USB Serial
[ 7483.713970] usbcore: registered new interface driver usbserial_generic
[ 7483.713978] usbserial: USB Serial support registered for generic
[ 7483.716746] usbcore: registered new interface driver ch341
[ 7483.716759] usbserial: USB Serial support registered for ch341-uart
[ 7483.716776] ch341 2-2:1.0: ch341-uart converter detected
[ 7483.718195] usb 2-2: ch341-uart converter now attached to ttyUSB0
+ +

udev

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
cat /lib/udev/rules.d/60-serial.rules
# /dev/serial/by-path/, /dev/serial/by-id/ for USB devices
KERNEL!="ttyUSB[0-9]*|ttyACM[0-9]*", GOTO="serial_end"

$ /bin/udevadm info /dev/ttyUSB0
P: /devices/pci0000:00/0000:00:14.0/usb2/2-2/2-2:1.0/ttyUSB0/tty/ttyUSB0
N: ttyUSB0
L: 0
S: serial/by-id/usb-1a86_USB_Serial-if00-port0
S: serial/by-path/pci-0000:00:14.0-usb-0:2:1.0-port0
E: DEVPATH=/devices/pci0000:00/0000:00:14.0/usb2/2-2/2-2:1.0/ttyUSB0/tty/ttyUSB0
E: DEVNAME=/dev/ttyUSB0
E: MAJOR=188
E: MINOR=0
E: SUBSYSTEM=tty
E: USEC_INITIALIZED=2833769
E: ID_BUS=usb
E: ID_VENDOR_ID=1a86
E: ID_MODEL_ID=7523
E: ID_PCI_CLASS_FROM_DATABASE=Serial bus controller
E: ID_PCI_SUBCLASS_FROM_DATABASE=USB controller
E: ID_PCI_INTERFACE_FROM_DATABASE=XHCI
E: ID_VENDOR_FROM_DATABASE=QinHeng Electronics
E: ID_MODEL_FROM_DATABASE=HL-340 USB-Serial adapter
E: ID_VENDOR=1a86
E: ID_VENDOR_ENC=1a86
E: ID_MODEL=USB_Serial
E: ID_MODEL_ENC=USB\x20Serial
E: ID_REVISION=0264
E: ID_SERIAL=1a86_USB_Serial
E: ID_TYPE=generic
E: ID_USB_INTERFACES=:ff0102:
E: ID_USB_INTERFACE_NUM=00
E: ID_USB_DRIVER=ch341
E: ID_USB_CLASS_FROM_DATABASE=Vendor Specific Class
E: ID_PATH=pci-0000:00:14.0-usb-0:2:1.0
E: ID_PATH_TAG=pci-0000_00_14_0-usb-0_2_1_0
E: ID_MM_CANDIDATE=1
E: DEVLINKS=/dev/serial/by-id/usb-1a86_USB_Serial-if00-port0 /dev/serial/by-path/pci-0000:00:14.0-usb-0:2:1.0-port0
E: TAGS=:systemd:
+ +

minicom

1
$ sudo minicom -b 115200 -8 -D /dev/ttyUSB0
+ +

Booting Raspberry Pi

dmesg

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
$ dmesg
MMC: mmc@7e202000: 0, mmcnr@7e300000: 1
Loading Environment from FAT... *** Warning - bad CRC, using default environment

In: serial
Out: vidconsole
Err: vidconsole
Net: No ethernet found.
starting USB...
Bus usb@7e980000: scanning bus usb@7e980000 for devices... 6 USB Device(s) found
scanning usb for storage devices... 0 Storage Device(s) found
## Info: input data size = 6 = 0x6
Hit any key to stop autoboot: 0
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
Found U-Boot script /boot.scr
2569 bytes read in 3 ms (835.9 KiB/s)
## Executing script at 02400000
8390521 bytes read in 363 ms (22 MiB/s)
Total of 1 halfword(s) were the same
Decompressing kernel...
Uncompressed size: 25907712 = 0x18B5200
29530201 bytes read in 2004 ms (14.1 MiB/s)
Booting Ubuntu (with booti) from mmc 0:...
## Flattened Device Tree blob at 02600000
Booting using the fdt blob at 0x2600000
Using Device Tree in place at 0000000002600000, end 000000000260a2a7

Starting kernel ...

[ 0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd034]
[ 0.000000] Linux version 5.4.0-1015-raspi (buildd@bos02-arm64-074) (gcc version 9.3.0 (Ubuntu 9.3.0-10ubuntu2)) #15-Ubuntu SMP Fri Jul 10 0)
[ 0.000000] Machine model: Raspberry Pi 3 Model B Plus Rev 1.3
[ 0.000000] earlycon: pl11 at MMIO32 0x000000003f201000 (options '')
[ 0.000000] printk: bootconsole [pl11] enabled
[ 2.054330] spi-bcm2835 3f204000.spi: could not get clk: -517
ext4
Thu Jan 1 00:00:10 UTC 1970
[ 0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd034]
[ 0.000000] Linux version 5.4.0-1015-raspi (buildd@bos02-arm64-074) (gcc version 9.3.0 (Ubuntu 9.3.0-10ubuntu2)) #15-Ubuntu SMP Fri Jul 10 0)
[ 0.000000] Machine model: Raspberry Pi 3 Model B Plus Rev 1.3
[ 0.000000] efi: Getting EFI parameters from FDT:
[ 0.000000] efi: UEFI not found.
[ 0.000000] Reserved memory: created CMA memory pool at 0x0000000037400000, size 64 MiB
[ 0.000000] OF: reserved mem: initialized node linux,cma, compatible id shared-dma-pool
[ 0.000000] On node 0 totalpages: 242688
[ 0.000000] DMA zone: 3792 pages used for memmap
[ 0.000000] DMA zone: 0 pages reserved
[ 0.000000] DMA zone: 242688 pages, LIFO batch:63
[ 0.000000] percpu: Embedded 32 pages/cpu s92120 r8192 d30760 u131072
[ 0.000000] pcpu-alloc: s92120 r8192 d30760 u131072 alloc=32*4096
[ 0.000000] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3
[ 0.000000] Detected VIPT I-cache on CPU0
[ 0.000000] CPU features: detected: ARM erratum 845719
[ 0.000000] CPU features: kernel page table isolation forced ON by KASLR
[ 0.000000] CPU features: detected: Kernel page table isolation (KPTI)
[ 0.000000] CPU features: detected: ARM erratum 843419
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 238896
[ 0.000000] Kernel command line: coherent_pool=1M 8250.nr_uarts=1 snd_bcm2835.enable_compat_alsa=0 snd_bcm2835.enable_hdmi=1 snd_bcm2835.enh
[ 0.000000] Dentry cache hash table entries: 131072 (order: 8, 1048576 bytes, linear)
[ 0.000000] Inode-cache hash table entries: 65536 (order: 7, 524288 bytes, linear)
[ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[ 0.000000] Memory: 829476K/970752K available (11772K kernel code, 1236K rwdata, 4244K rodata, 6144K init, 1072K bss, 75740K reserved, 65536)
[ 0.000000] random: get_random_u64 called from kmem_cache_open+0x38/0x3e0 with crng_init=0
[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[ 0.000000] ftrace: allocating 38984 entries in 153 pages
[ 0.000000] rcu: Hierarchical RCU implementation.
[ 0.000000] Tasks RCU enabled.
[ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
[ 0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[ 0.000000] arch_timer: cp15 timer(s) running at 19.20MHz (phys).
[ 0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x46d987e47, max_idle_ns: 440795202767 ns
[ 0.000006] sched_clock: 56 bits at 19MHz, resolution 52ns, wraps every 4398046511078ns
[ 0.000260] Console: colour dummy device 80x25
[ 0.000287] printk: console [tty1] enabled
[ 0.000347] Calibrating delay loop (skipped), value calculated using timer frequency.. 38.40 BogoMIPS (lpj=76800)
[ 0.000365] pid_max: default: 32768 minimum: 301
[ 0.000686] LSM: Security Framework initializing
[ 0.000751] Yama: becoming mindful.
[ 0.000881] AppArmor: AppArmor initialized
[ 0.001161] Mount-cache hash table entries: 2048 (order: 2, 16384 bytes, linear)
[ 0.001193] Mountpoint-cache hash table entries: 2048 (order: 2, 16384 bytes, linear)
[ 0.001297] *** VALIDATE tmpfs ***
[ 0.002208] *** VALIDATE proc ***
[ 0.002828] Disabling memory control group subsystem
[ 0.002919] *** VALIDATE cgroup1 ***
[ 0.002933] *** VALIDATE cgroup2 ***
[ 0.004826] ASID allocator initialised with 32768 entries
[ 0.005072] rcu: Hierarchical SRCU implementation.
[ 0.007837] EFI services will not be available.
[ 0.009107] smp: Bringing up secondary CPUs ...
[ 0.010429] Detected VIPT I-cache on CPU1
[ 0.010499] CPU1: Booted secondary processor 0x0000000001 [0x410fd034]
[ 0.012469] Detected VIPT I-cache on CPU2
[ 0.012521] CPU2: Booted secondary processor 0x0000000002 [0x410fd034]
[ 0.014254] Detected VIPT I-cache on CPU3
[ 0.014302] CPU3: Booted secondary processor 0x0000000003 [0x410fd034]
[ 0.014794] smp: Brought up 1 node, 4 CPUs
[ 0.014807] SMP: Total of 4 processors activated.
[ 0.014820] CPU features: detected: 32-bit EL0 Support
[ 0.014834] CPU features: detected: CRC32 instructions
[ 0.021015] CPU features: emulated: Privileged Access Never (PAN) using TTBR0_EL1 switching
[ 0.021028] CPU: All CPU(s) started at EL2
[ 0.021134] alternatives: patching kernel code
[ 0.023645] devtmpfs: initialized
[ 0.039386] Enabled cp15_barrier support
[ 0.039421] Enabled setend support
[ 0.040165] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[ 0.040194] futex hash table entries: 1024 (order: 4, 65536 bytes, linear)
[ 0.043935] pinctrl core: initialized pinctrl subsystem
[ 0.044950] DMI not present or invalid.
[ 0.045954] NET: Registered protocol family 16
[ 0.054411] DMA: preallocated 1024 KiB pool for atomic allocations
[ 0.054453] audit: initializing netlink subsys (disabled)
[ 0.054792] audit: type=2000 audit(0.052:1): state=initialized audit_enabled=0 res=1
[ 0.055685] cpuidle: using governor ladder
[ 0.055736] cpuidle: using governor menu
[ 0.056607] hw-breakpoint: found 6 breakpoint and 4 watchpoint registers.
[ 0.057083] Serial: AMBA PL011 UART driver
[ 0.060033] bcm2835-mbox 3f00b880.mailbox: mailbox enabled
[ 0.076378] raspberrypi-firmware soc:firmware: Attached to firmware from 2020-06-01 13:25, variant start
[ 0.080391] raspberrypi-firmware soc:firmware: Firmware hash is 6379679d1ec6a8c746d7e77e015f5b56b939976f
[ 0.146654] bcm2835-dma 3f007000.dma: DMA legacy API manager, dmachans=0x1
[ 0.150165] iommu: Default domain type: Translated
[ 0.152048] SCSI subsystem initialized
[ 0.152435] libata version 3.00 loaded.
[ 0.152716] usbcore: registered new interface driver usbfs
[ 0.152779] usbcore: registered new interface driver hub
[ 0.152969] usbcore: registered new device driver usb
[ 0.153417] pps_core: LinuxPPS API ver. 1 registered
[ 0.153428] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[ 0.153456] PTP clock support registered
[ 0.153901] EDAC MC: Ver: 3.0.0
[ 0.155940] NetLabel: Initializing
[ 0.155952] NetLabel: domain hash size = 128
[ 0.155961] NetLabel: protocols = UNLABELED CIPSOv4 CALIPSO
[ 0.156064] NetLabel: unlabeled traffic allowed by default
[ 0.157577] clocksource: Switched to clocksource arch_sys_counter
[ 0.283228] *** VALIDATE bpf ***
[ 0.283760] VFS: Disk quotas dquot_6.6.0
[ 0.283890] VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
[ 0.284053] *** VALIDATE ramfs ***
[ 0.284879] AppArmor: AppArmor Filesystem Enabled
[ 0.285340] simple-framebuffer 3e513000.framebuffer: framebuffer at 0x3e513000, 0x6d8c00 bytes, mapped to 0x(____ptrval____)
[ 0.285358] simple-framebuffer 3e513000.framebuffer: format=a8r8g8b8, mode=1824x984x32, linelength=7296
[ 0.286145] Console: switching to colour frame buffer device 228x61
[ 0.315614] simple-framebuffer 3e513000.framebuffer: fb0: simplefb registered!
[ 0.329105] thermal_sys: Registered thermal governor 'fair_share'
[ 0.329112] thermal_sys: Registered thermal governor 'bang_bang'
[ 0.329126] thermal_sys: Registered thermal governor 'step_wise'
[ 0.329136] thermal_sys: Registered thermal governor 'user_space'
[ 0.329146] thermal_sys: Registered thermal governor 'power_allocator'
[ 0.330022] NET: Registered protocol family 2
[ 0.330984] tcp_listen_portaddr_hash hash table entries: 512 (order: 1, 8192 bytes, linear)
[ 0.331047] TCP established hash table entries: 8192 (order: 4, 65536 bytes, linear)
[ 0.331166] TCP bind hash table entries: 8192 (order: 5, 131072 bytes, linear)
[ 0.331375] TCP: Hash tables configured (established 8192 bind 8192)
[ 0.331650] UDP hash table entries: 512 (order: 2, 16384 bytes, linear)
[ 0.331702] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes, linear)
[ 0.332035] NET: Registered protocol family 1
[ 0.332072] NET: Registered protocol family 44
[ 0.332096] PCI: CLS 0 bytes, default 64
[ 0.332458] Trying to unpack rootfs image as initramfs...
[ 1.378972] Freeing initrd memory: 28836K
[ 1.380898] hw perfevents: enabled with armv8_cortex_a53 PMU driver, 7 counters available
[ 1.381102] kvm [1]: IPA Size Limit: 40bits
[ 1.382500] kvm [1]: Hyp mode initialized successfully
[ 1.387002] Initialise system trusted keyrings
[ 1.387066] Key type blacklist registered
[ 1.387445] workingset: timestamp_bits=46 max_order=18 bucket_order=0
[ 1.398078] zbud: loaded
[ 1.401076] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[ 1.402674] fuse: init (API version 7.31)
[ 1.402822] *** VALIDATE fuse ***
[ 1.402840] *** VALIDATE fuse ***
[ 1.442720] Key type asymmetric registered
[ 1.442740] Asymmetric key parser 'x509' registered
[ 1.442862] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 242)
[ 1.443271] io scheduler mq-deadline registered
[ 1.448892] bcm2708_fb soc:fb: FB found 1 display(s)
[ 1.468274] bcm2708_fb soc:fb: Registered framebuffer for display 0, size 1824x984
[ 1.470592] raspberrypi-clk firmware-clocks: CPU frequency range: min 600000000, max 1400000000
[ 1.556496] Serial: 8250/16550 driver, 1 ports, IRQ sharing enabled
[ 1.559335] bcm2835-rng 3f104000.rng: hwrng registered
[ 1.560029] vc-mem: phys_addr:0x00000000 mem_base=0x3ec00000 mem_size:0x40000000(1024 MiB)
[ 1.561043] gpiomem-bcm2835 3f200000.gpiomem: Initialised: Registers at 0x3f200000
[ 1.561452] cacheinfo: Unable to detect cache hierarchy for CPU 0
[ 2.075477] loop: module loaded
[ 2.079092] spi-bcm2835 3f204000.spi: could not get clk: -517
[ 2.081685] libphy: Fixed MDIO Bus: probed
[ 2.081738] tun: Universal TUN/TAP device driver, 1.6
[ 2.082268] PPP generic driver version 2.4.2
[ 2.082583] usbcore: registered new interface driver lan78xx
[ 2.082660] usbcore: registered new interface driver smsc95xx
[ 2.082704] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 2.082736] ehci-pci: EHCI PCI platform driver
[ 2.082806] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[ 2.082829] ohci-pci: OHCI PCI platform driver
[ 2.082895] uhci_hcd: USB Universal Host Controller Interface driver
[ 2.083070] dwc_otg: version 3.00a 10-AUG-2012 (platform bus)
[ 2.296973] Core Release: 2.80a
[ 2.296988] Setting default values for core params
[ 2.297019] Finished setting default values for core params
[ 2.510643] Using Buffer DMA mode
[ 2.510655] Periodic Transfer Interrupt Enhancement - disabled
[ 2.510664] Multiprocessor Interrupt Enhancement - disabled
[ 2.510677] OTG VER PARAM: 0, OTG VER FLAG: 0
[ 2.510696] Dedicated Tx FIFOs mode
[ 2.511598] WARN::dwc_otg_hcd_init:1072: FIQ DMA bounce buffers: virt = ffff8000105f6000 dma = 0x00000000f7510000 len=9024
[ 2.511631] FIQ FSM acceleration enabled for :
Non-periodic Split Transactions
Periodic Split Transactions
High-Speed Isochronous Endpoints
Interrupt/Control Split Transaction hack enabled
[ 2.511644] dwc_otg: Microframe scheduler enabled
[ 2.511692] WARN::hcd_init_fiq:496: MPHI regs_base at ffff800010075000
[ 2.511764] dwc_otg 3f980000.usb: DWC OTG Controller
[ 2.511848] dwc_otg 3f980000.usb: new USB bus registered, assigned bus number 1
[ 2.511901] dwc_otg 3f980000.usb: irq 9, io mem 0x00000000
[ 2.511953] Init: Port Power? op_state=1
[ 2.511963] Init: Power Port (0)
[ 2.512356] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.04
[ 2.512372] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[ 2.512386] usb usb1: Product: DWC OTG Controller
[ 2.512400] usb usb1: Manufacturer: Linux 5.4.0-1015-raspi dwc_otg_hcd
[ 2.512413] usb usb1: SerialNumber: 3f980000.usb
[ 2.513296] hub 1-0:1.0: USB hub found
[ 2.513365] hub 1-0:1.0: 1 port detected
[ 2.514366] dwc_otg: FIQ enabled
[ 2.514377] dwc_otg: NAK holdoff enabled
[ 2.514386] dwc_otg: FIQ split-transaction FSM enabled
[ 2.514402] Module dwc_common_port init
[ 2.515109] mousedev: PS/2 mouse device common for all mice
[ 2.515718] i2c /dev entries driver
[ 2.518763] bcm2835-wdt bcm2835-wdt: Broadcom BCM2835 watchdog timer
[ 2.519067] device-mapper: uevent: version 1.0.3
[ 2.519520] device-mapper: ioctl: 4.41.0-ioctl (2019-09-16) initialised: dm-devel@redhat.com
[ 2.520997] cpufreq: cpufreq_online: CPU0: Running at unlisted freq: 600000 KHz
[ 2.522326] cpufreq: cpufreq_online: CPU0: Unlisted initial frequency changed to: 700000 KHz
[ 2.524383] sdhci: Secure Digital Host Controller Interface driver
[ 2.524393] sdhci: Copyright(c) Pierre Ossman
[ 2.525029] mmc-bcm2835 3f300000.mmcnr: could not get clk, deferring probe
[ 2.525700] sdhost-bcm2835 3f202000.mmc: could not get clk, deferring probe
[ 2.525926] sdhci-pltfm: SDHCI platform and OF driver helper
[ 2.529004] ledtrig-cpu: registered to indicate activity on CPUs
[ 2.529190] hidraw: raw HID events driver (C) Jiri Kosina
[ 2.530608] vchiq: vchiq_init_state: slot_zero = (____ptrval____)
[ 2.535891] drop_monitor: Initializing network drop monitor service
[ 2.537232] NET: Registered protocol family 10
[ 2.606018] Segment Routing with IPv6
[ 2.606097] NET: Registered protocol family 17
[ 2.606296] Key type dns_resolver registered
[ 2.606930] registered taskstats version 1
[ 2.606971] Loading compiled-in X.509 certificates
[ 2.615324] Loaded X.509 cert 'Build time autogenerated kernel key: 3adb930cf2b588b24a16b9e880af77294eec0e1a'
[ 2.615713] Key type ._fscrypt registered
[ 2.615720] Key type .fscrypt registered
[ 2.640941] cryptd: max_cpu_qlen set to 1000
[ 2.721869] Indeed it is in host mode hprt0 = 00021501
[ 2.800492] random: fast init done
[ 2.913659] usb 1-1: new high-speed USB device number 2 using dwc_otg
[ 2.913882] Indeed it is in host mode hprt0 = 00001101
[ 2.948493] Key type big_key registered
[ 3.054864] Key type encrypted registered
[ 3.054908] AppArmor: AppArmor sha1 policy hashing enabled
[ 3.054959] ima: No TPM chip found, activating TPM-bypass!
[ 3.055008] ima: Allocated hash algorithm: sha1
[ 3.055074] ima: No architecture policies found
[ 3.055152] evm: Initialising EVM extended attributes:
[ 3.055161] evm: security.selinux
[ 3.055171] evm: security.SMACK64
[ 3.055180] evm: security.SMACK64EXEC
[ 3.055189] evm: security.SMACK64TRANSMUTE
[ 3.055198] evm: security.SMACK64MMAP
[ 3.055207] evm: security.apparmor
[ 3.055217] evm: security.ima
[ 3.055225] evm: security.capability
[ 3.055235] evm: HMAC attrs: 0x1
[ 3.070314] uart-pl011 3f201000.serial: cts_event_workaround enabled
[ 3.070468] 3f201000.serial: ttyAMA0 at MMIO 0x3f201000 (irq = 66, base_baud = 0) is a PL011 rev2
[ 3.076348] printk: console [ttyAMA0] enabled
[ 3.081609] 3f215040.serial: ttyS0 at MMIO 0x0 (irq = 61, base_baud = 50000000) is a 16550
[ 3.082710] bcm2835-power bcm2835-power: Broadcom BCM2835 power domains driver
[ 3.089098] mmc-bcm2835 3f300000.mmcnr: mmc_debug:0 mmc_debug2:0
[ 3.089117] mmc-bcm2835 3f300000.mmcnr: DMA channel allocated
[ 3.115514] sdhost: log_buf @ (____ptrval____) (ebd38000)
[ 3.138484] usb 1-1: New USB device found, idVendor=0424, idProduct=2514, bcdDevice= b.b3
[ 3.138501] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 3.139423] hub 1-1:1.0: USB hub found
[ 3.139585] hub 1-1:1.0: 4 ports detected
[ 3.154588] mmc1: queuing unknown CIS tuple 0x80 (2 bytes)
[ 3.156280] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[ 3.157961] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[ 3.160948] mmc1: queuing unknown CIS tuple 0x80 (7 bytes)
[ 3.167550] mmc0: sdhost-bcm2835 loaded - DMA enabled (>1)
[ 3.170628] hctosys: unable to open rtc device (rtc0)
[ 3.171340] of_cfs_init
[ 3.171504] of_cfs_init: OK
[ 3.208152] Freeing unused kernel memory: 6144K
[ 3.226264] Checked W+X mappings: passed, no W+X pages found
[ 3.226286] Run /init as init process
[ 3.230254] mmc0: host does not support reading read-only switch, assuming write-enable
[ 3.233343] mmc0: new high speed SDXC card at address 5048
[ 3.236559] mmcblk0: mmc0:5048 SD64G 58.2 GiB
[ 3.241905] mmcblk0: p1 p2
[ 3.251456] mmc1: new high speed SDIO card at address 0001
[ 3.394817] random: systemd-udevd: uninitialized urandom read (16 bytes read)
[ 3.403359] random: systemd-udevd: uninitialized urandom read (16 bytes read)
[ 3.403437] random: systemd-udevd: uninitialized urandom read (16 bytes read)
[ 3.425734] usb 1-1.1: new high-speed USB device number 3 using dwc_otg
[ 3.526158] usb 1-1.1: New USB device found, idVendor=0424, idProduct=2514, bcdDevice= b.b3
[ 3.526181] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 3.527365] hub 1-1.1:1.0: USB hub found
[ 3.527524] hub 1-1.1:1.0: 3 ports detected
[ 3.761645] usb 1-1.2: new high-speed USB device number 4 using dwc_otg
[ 3.862355] usb 1-1.2: New USB device found, idVendor=214b, idProduct=7250, bcdDevice= 1.00
[ 3.862376] usb 1-1.2: New USB device strings: Mfr=0, Product=1, SerialNumber=0
[ 3.862391] usb 1-1.2: Product: USB2.0 HUB
[ 3.863513] hub 1-1.2:1.0: USB hub found
[ 3.863683] hub 1-1.2:1.0: 4 ports detected
[ 3.968215] random: crng init done
[ 3.968229] random: 7 urandom warning(s) missed due to ratelimiting
[ 4.149652] usb 1-1.2.1: new high-speed USB device number 5 using dwc_otg
[ 4.251348] usb 1-1.2.1: New USB device found, idVendor=0bda, idProduct=8152, bcdDevice=20.00
[ 4.251370] usb 1-1.2.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 4.251385] usb 1-1.2.1: Product: USB 10/100 LAN
[ 4.251400] usb 1-1.2.1: Manufacturer: Realtek
[ 4.251414] usb 1-1.2.1: SerialNumber: 00E04C3603B4
[ 4.329685] usb 1-1.1.1: new high-speed USB device number 6 using dwc_otg
[ 4.430387] usb 1-1.1.1: New USB device found, idVendor=0424, idProduct=7800, bcdDevice= 3.00
[ 4.430410] usb 1-1.1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 4.697441] lan78xx 1-1.1.1:1.0 (unnamed net_device) (uninitialized): No External EEPROM. Setting MAC Speed
[ 4.699201] libphy: lan78xx-mdiobus: probed
[ 4.722086] lan78xx 1-1.1.1:1.0 (unnamed net_device) (uninitialized): int urb period 64
[ 5.118464] usb_phy_generic phy: phy supply vcc not found, using dummy regulator
[ 9.053578] raid6: neonx8 gen() 722 MB/s
[ 9.101597] raid6: neonx8 xor() 690 MB/s
[ 9.149625] raid6: neonx4 gen() 709 MB/s
[ 9.197583] raid6: neonx4 xor() 685 MB/s
[ 9.245595] raid6: neonx2 gen() 518 MB/s
[ 9.293608] raid6: neonx2 xor() 535 MB/s
[ 9.341602] raid6: neonx1 gen() 313 MB/s
[ 9.389635] raid6: neonx1 xor() 340 MB/s
[ 9.437574] raid6: int64x8 gen() 548 MB/s
[ 9.485610] raid6: int64x8 xor() 362 MB/s
[ 9.533656] raid6: int64x4 gen() 462 MB/s
[ 9.581652] raid6: int64x4 xor() 340 MB/s
[ 9.629736] raid6: int64x2 gen() 294 MB/s
[ 9.677580] raid6: int64x2 xor() 250 MB/s
[ 9.725749] raid6: int64x1 gen() 175 MB/s
[ 9.773586] raid6: int64x1 xor() 162 MB/s
[ 9.773596] raid6: using algorithm neonx8 gen() 722 MB/s
[ 9.773606] raid6: .... xor() 690 MB/s, rmw enabled
[ 9.773617] raid6: using neon recovery algorithm
[ 9.788230] xor: measuring software checksum speed
[ 9.825579] 8regs : 1164.000 MB/sec
[ 9.865570] 32regs : 1336.000 MB/sec
[ 9.905571] arm64_neon: 1154.000 MB/sec
[ 9.905583] xor: using function: 32regs (1336.000 MB/sec)
[ 9.912987] async_tx: api initialized (async)
[ 10.062633] uart-pl011 3f201000.serial: no DMA platform data
[ 10.432703] Btrfs loaded, crc32c=crc32c-generic
[ 10.820526] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[ 12.183534] systemd[1]: System time before build time, advancing clock.
[ 12.261314] systemd[1]: Inserted module 'autofs4'
[ 12.435956] systemd[1]: systemd 245.4-4ubuntu3.2 running in system mode. (+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRY)
[ 12.438138] systemd[1]: Detected architecture arm64.
[ 12.610732] systemd[1]: Set hostname to <ubuntu>.
[ 12.611936] systemd[1]: Initializing machine ID from random generator.
[ 12.612333] systemd[1]: Installed transient /etc/machine-id file.
[ 14.000655] systemd[1]: /lib/systemd/system/dbus.socket:5: ListenStream= references a path below legacy directory /var/run/, updating /var/r.
[ 14.452929] systemd[1]: Created slice system-modprobe.slice.
[ 14.455816] systemd[1]: Created slice system-serial\x2dgetty.slice.
[ 14.458069] systemd[1]: Created slice system-systemd\x2dfsck.slice.
[ 14.459866] systemd[1]: Created slice User and Session Slice.
[ 14.460685] systemd[1]: Started Forward Password Requests to Wall Directory Watch.
[ 14.478248] systemd[1]: Set up automount Arbitrary Executable File Formats File System Automount Point.
[ 14.478872] systemd[1]: Reached target User and Group Name Lookups.
[ 14.479051] systemd[1]: Reached target Slices.
[ 14.479206] systemd[1]: Reached target Swap.
[ 14.480209] systemd[1]: Listening on Device-mapper event daemon FIFOs.
[ 14.481341] systemd[1]: Listening on LVM2 poll daemon socket.
[ 14.482158] systemd[1]: Listening on multipathd control socket.
[ 14.483165] systemd[1]: Listening on Syslog Socket.
[ 14.484125] systemd[1]: Listening on fsck to fsckd communication Socket.
[ 14.484710] systemd[1]: Listening on initctl Compatibility Named Pipe.
[ 14.486764] systemd[1]: Listening on Journal Audit Socket.
[ 14.487886] systemd[1]: Listening on Journal Socket (/dev/log).
[ 14.489257] systemd[1]: Listening on Journal Socket.
[ 14.490934] systemd[1]: Listening on Network Service Netlink Socket.
[ 14.492064] systemd[1]: Listening on udev Control Socket.
[ 14.492899] systemd[1]: Listening on udev Kernel Socket.
[ 14.494128] systemd[1]: Condition check resulted in Huge Pages File System being skipped.
[ 14.503724] systemd[1]: Mounting POSIX Message Queue File System...
[ 14.515218] systemd[1]: Mounting Kernel Debug File System...
[ 14.527339] systemd[1]: Mounting Kernel Trace File System...
[ 14.542363] systemd[1]: Starting Journal Service...
[ 14.553428] systemd[1]: Starting Set the console keyboard layout...
[ 14.565065] systemd[1]: Starting Create list of static device nodes for the current kernel...
[ 14.577044] systemd[1]: Starting Monitoring of LVM2 mirrors, snapshots etc. using dmeventd or progress polling...
[ 14.590422] systemd[1]: Starting Load Kernel Module drm...
[ 14.595104] systemd[1]: Condition check resulted in Set Up Additional Binary Formats being skipped.
[ 14.611843] systemd[1]: Starting Load Kernel Modules...
[ 14.623516] systemd[1]: Starting Remount Root and Kernel File Systems...
[ 14.636423] systemd[1]: Starting udev Coldplug all Devices...
[ 14.659646] systemd[1]: Starting Uncomplicated firewall...
[ 14.691981] systemd[1]: Mounted POSIX Message Queue File System.
[ 14.699810] systemd[1]: Mounted Kernel Debug File System.
[ 14.702881] systemd[1]: Mounted Kernel Trace File System.
[ 14.710649] systemd[1]: Finished Create list of static device nodes for the current kernel.
[ 14.735134] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[ 14.774544] systemd[1]: Finished Load Kernel Modules.
[ 14.788634] systemd[1]: Finished Remount Root and Kernel File Systems.
[ 14.797202] systemd[1]: Finished Uncomplicated firewall.
[ 14.804560] systemd[1]: modprobe@drm.service: Succeeded.
[ 14.809244] systemd[1]: Finished Load Kernel Module drm.
[ 14.824824] systemd[1]: Mounting FUSE Control File System...
[ 14.862218] systemd[1]: Mounting Kernel Configuration File System...
[ 14.867566] systemd[1]: Condition check resulted in Rebuild Hardware Database being skipped.
[ 14.868171] systemd[1]: Condition check resulted in Platform Persistent Storage Archival being skipped.
[ 14.894956] systemd[1]: Starting Load/Save Random Seed...
[ 14.931144] systemd[1]: Starting Apply Kernel Variables...
[ 14.955439] systemd[1]: Starting Create System Users...
[ 14.974058] systemd[1]: Mounted FUSE Control File System.
[ 14.976534] systemd[1]: Mounted Kernel Configuration File System.
[ 15.003627] systemd[1]: Finished Load/Save Random Seed.
[ 15.095931] systemd[1]: Finished Apply Kernel Variables.
[ 15.149796] systemd[1]: Started Journal Service.
[ 15.237001] systemd-journald[702]: Received client request to flush runtime journal.
[ 16.877675] vc_sm_cma: module is from the staging directory, the quality is unknown, you have been warned.
[ 16.879156] vc_sm_cma: module verification failed: signature and/or required key missing - tainting kernel
[ 16.881833] bcm2835_vc_sm_cma_probe: Videocore shared memory driver
[ 16.881858] [vc_sm_connected_init]: start
[ 16.890942] [vc_sm_connected_init]: installed successfully
[ 16.927634] mc: Linux media interface: v0.10
[ 17.016274] videodev: Linux video capture interface: v2.00
[ 17.094530] snd_bcm2835: module is from the staging directory, the quality is unknown, you have been warned.
[ 17.105655] bcm2835_audio bcm2835_audio: card created with 4 channels
[ 17.120526] bcm2835_audio bcm2835_audio: card created with 4 channels
[ 17.168733] bcm2835_mmal_vchiq: module is from the staging directory, the quality is unknown, you have been warned.
[ 17.168738] bcm2835_mmal_vchiq: module is from the staging directory, the quality is unknown, you have been warned.
[ 17.207611] bcm2835_v4l2: module is from the staging directory, the quality is unknown, you have been warned.
[ 17.209252] bcm2835_isp: module is from the staging directory, the quality is unknown, you have been warned.
[ 17.222740] bcm2835-isp bcm2835-isp: Device node output[0] registered as /dev/video13
[ 17.223384] bcm2835-isp bcm2835-isp: Device node capture[0] registered as /dev/video14
[ 17.223898] bcm2835-isp bcm2835-isp: Device node capture[1] registered as /dev/video15
[ 17.224326] bcm2835-isp bcm2835-isp: Device node stats[2] registered as /dev/video16
[ 17.224367] bcm2835-isp bcm2835-isp: Register output node 0 with media controller
[ 17.224414] bcm2835-isp bcm2835-isp: Register capture node 1 with media controller
[ 17.224435] bcm2835-isp bcm2835-isp: Register capture node 2 with media controller
[ 17.224453] bcm2835-isp bcm2835-isp: Register capture node 3 with media controller
[ 17.224716] bcm2835-isp bcm2835-isp: Loaded V4L2 bcm2835-isp
[ 17.238551] bcm2835_codec: module is from the staging directory, the quality is unknown, you have been warned.
[ 17.252985] bcm2835-codec bcm2835-codec: Device registered as /dev/video10
[ 17.253073] bcm2835-codec bcm2835-codec: Loaded V4L2 decode
[ 17.261328] bcm2835-codec bcm2835-codec: Device registered as /dev/video11
[ 17.261411] bcm2835-codec bcm2835-codec: Loaded V4L2 encode
[ 17.269340] bcm2835-codec bcm2835-codec: Device registered as /dev/video12
[ 17.269398] bcm2835-codec bcm2835-codec: Loaded V4L2 isp
[ 17.358612] usbcore: registered new interface driver r8152
[ 17.463917] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[ 17.464029] usbcore: registered new interface driver cdc_ether
[ 17.465794] usb 1-1.2.1: reset high-speed USB device number 5 using dwc_otg
[ 17.494112] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[ 17.627952] r8152 1-1.2.1:1.0 eth1: v1.10.11
[ 17.686213] brcmfmac: F1 signature read @0x18000000=0x15264345
[ 17.699959] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43455-sdio for chip BCM4345/6
[ 17.712716] usbcore: registered new interface driver brcmfmac
[ 18.083763] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43455-sdio for chip BCM4345/6
[ 18.116917] Bluetooth: Core ver 2.22
[ 18.121182] NET: Registered protocol family 31
[ 18.121208] Bluetooth: HCI device and connection manager initialized
[ 18.121272] Bluetooth: HCI socket layer initialized
[ 18.121295] Bluetooth: L2CAP socket layer initialized
[ 18.121361] Bluetooth: SCO socket layer initialized
[ 18.134898] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM4345/6 wl0: Mar 2 2020 23:30:41 version 7.45.202 (r724630 CY) FWID 01-72f6ece2
[ 19.197787] Under-voltage detected! (0x00050005)
[ 21.729959] alua: device handler registered
[ 21.740622] emc: device handler registered
[ 21.752384] rdac: device handler registered
[ 43.106274] EXT4-fs (mmcblk0p2): resizing filesystem from 727862 to 15195899 blocks
[ 43.903500] EXT4-fs (mmcblk0p2): resized filesystem to 15195899
+ +

First login

The default passwords for the images are ubuntu/ubuntu.

+
1
2
3
4
5
6
7
8
9
10
Ubuntu 20.04.1 LTS ubuntu ttyAMA0

ubuntu login: ubuntu
Password:
You are required to change your password immediately (administrator enforced)
Changing password for ubuntu.
Current password:
New password:
Retype new password:
Welcome to Ubuntu 20.04.1 LTS (GNU/Linux 5.4.0-1015-raspi aarch64)
+ +

UART

1
2
3
4
5
6
7
8
9
10
11
12
13
$ dmesg | grep -E "pl11|8250|uart|tty"
[ 0.000000] earlycon: pl11 at MMIO32 0x000000003f201000 (options '')
[ 0.000000] printk: bootconsole [pl11] enabled
[ 0.000000] Kernel command line: coherent_pool=1M 8250.nr_uarts=1 snd_bcm2835.enable_compat_alsa=0 snd_bcm2835.enabh
[ 0.000295] printk: console [tty1] enabled
[ 0.000309] printk: bootconsole [pl11] disabled
[ 1.568625] Serial: 8250/16550 driver, 1 ports, IRQ sharing enabled
[ 2.824711] uart-pl011 3f201000.serial: cts_event_workaround enabled
[ 2.824870] 3f201000.serial: ttyAMA0 at MMIO 0x3f201000 (irq = 66, base_baud = 0) is a PL011 rev2
[ 2.837279] printk: console [ttyAMA0] enabled
[ 2.842675] 3f215040.serial: ttyS0 at MMIO 0x0 (irq = 61, base_baud = 50000000) is a 16550
[ 9.413998] uart-pl011 3f201000.serial: no DMA platform data
[ 13.224799] systemd[1]: Created slice system-serial\x2dgetty.slice.
+ +

Setup ssh daemon

1
2
3
4
5
6
7
8
9
10
11
12
$ sudo vi /etc/ssh/sshd_config
PermitRootLogin yes
#PermitRootLogin prohibit-password

$ sudo /etc/init.d/ssh reload
Reloading ssh configuration (via systemctl): ssh.service.

$ sudo vi /etc/pam.d/sshd
# session optional pam_motd.so motd=/run/motd.dynamic

$ sudo vi /etc/pam.d/login
# session optional pam_motd.so motd=/run/motd.dynamic
+ +

System characteristics

Dimension

Raspberry Pi 3 B+ dimension

+

uname

1
2
3
4
5
$ uname -snrmp
Linux ubuntu 5.4.0-1022-raspi aarch64 aarch64

$ uname -a
Linux ubuntu 5.4.0-1022-raspi #25-Ubuntu SMP PREEMPT Thu Oct 15 13:31:49 UTC 2020 aarch64 aarch64 aarch64 GNU/Linux
+ +

/etc/os-release

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
$ ls -l /etc/os-release
lrwxrwxrwx 1 root root 21 Aug 17 13:31 /etc/os-release -> ../usr/lib/os-release

$ cat /usr/lib/os-release
NAME="Ubuntu"
VERSION="20.04.1 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.1 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

$ file /bin/cat
/bin/cat: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, BuildID[sha1]=4fdc558fb1da46e60411d3c23414c4bf99b1265f, for GNU/Linux 3.7.0, stripped

$ ldd /bin/cat
linux-vdso.so.1 (0x0000ffff82004000)
libc.so.6 => /lib/aarch64-linux-gnu/libc.so.6 (0x0000ffff81e4a000)
/lib/ld-linux-aarch64.so.1 (0x0000ffff81fd4000)
+ +

ps

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
$ ps axf
PID TTY STAT TIME COMMAND
2 ? S 0:00 [kthreadd]
3 ? I< 0:00 \_ [rcu_gp]
4 ? I< 0:00 \_ [rcu_par_gp]
8 ? I< 0:00 \_ [mm_percpu_wq]
9 ? S 0:00 \_ [ksoftirqd/0]
10 ? I 0:01 \_ [rcu_sched]
11 ? S 0:00 \_ [migration/0]
12 ? S 0:00 \_ [idle_inject/0]
14 ? S 0:00 \_ [cpuhp/0]
15 ? S 0:00 \_ [cpuhp/1]
16 ? S 0:00 \_ [idle_inject/1]
17 ? S 0:00 \_ [migration/1]
18 ? S 0:00 \_ [ksoftirqd/1]
21 ? S 0:00 \_ [cpuhp/2]
22 ? S 0:00 \_ [idle_inject/2]
23 ? S 0:00 \_ [migration/2]
24 ? S 0:00 \_ [ksoftirqd/2]
25 ? I 0:00 \_ [kworker/2:0-events]
27 ? S 0:00 \_ [cpuhp/3]
28 ? S 0:00 \_ [idle_inject/3]
29 ? S 0:00 \_ [migration/3]
30 ? S 0:00 \_ [ksoftirqd/3]
33 ? S 0:00 \_ [kdevtmpfs]
34 ? I< 0:00 \_ [netns]
35 ? S 0:00 \_ [rcu_tasks_kthre]
37 ? I 0:00 \_ [kworker/1:1-events]
39 ? S 0:00 \_ [kauditd]
40 ? S 0:00 \_ [khungtaskd]
41 ? S 0:00 \_ [oom_reaper]
42 ? I< 0:00 \_ [writeback]
43 ? S 0:00 \_ [kcompactd0]
44 ? SN 0:00 \_ [ksmd]
46 ? I 0:00 \_ [kworker/u8:1-events_power_efficient]
138 ? I< 0:00 \_ [kintegrityd]
139 ? I< 0:00 \_ [kblockd]
140 ? I< 0:00 \_ [blkcg_punt_bio]
141 ? I< 0:00 \_ [tpm_dev_wq]
142 ? I< 0:00 \_ [ata_sff]
143 ? I< 0:00 \_ [md]
144 ? I< 0:00 \_ [edac-poller]
145 ? I< 0:00 \_ [devfreq_wq]
146 ? S 0:00 \_ [watchdogd]
147 ? S 0:00 \_ [kswapd0]
148 ? S 0:00 \_ [ecryptfs-kthrea]
151 ? I< 0:00 \_ [kthrotld]
152 ? I< 0:00 \_ [dwc_otg]
153 ? I< 0:00 \_ [DWC Notificatio]
154 ? I 0:00 \_ [kworker/0:2-events]
155 ? S< 0:00 \_ [vchiq-slot/0]
156 ? S< 0:00 \_ [vchiq-recy/0]
157 ? S< 0:00 \_ [vchiq-sync/0]
158 ? I< 0:00 \_ [ipv6_addrconf]
170 ? I< 0:00 \_ [kstrp]
174 ? I< 0:00 \_ [kworker/u9:0]
179 ? I< 0:00 \_ [cryptd]
180 ? I 0:00 \_ [kworker/3:2-mm_percpu_wq]
242 ? S 0:00 \_ [spi0]
244 ? I< 0:00 \_ [charger_manager]
247 ? I< 0:00 \_ [mmc_complete]
250 ? I< 0:00 \_ [kworker/2:1H-mmc_complete]
276 ? S 0:00 \_ [irq/151-usb-001]
282 ? I< 0:00 \_ [kworker/3:1H-mmc_complete]
284 ? I< 0:01 \_ [kworker/1:1H-mmc_complete]
290 ? I< 0:00 \_ [kworker/0:2H-mmc_complete]
570 ? I< 0:00 \_ [raid5wq]
627 ? S 0:00 \_ [jbd2/mmcblk0p2-]
628 ? I< 0:00 \_ [ext4-rsv-conver]
744 ? S 0:00 \_ [vchiq-keep/0]
745 ? S< 0:00 \_ [SMIO]
749 ? I< 0:00 \_ [mmal-vchiq]
750 ? I< 0:00 \_ [mmal-vchiq]
751 ? I< 0:00 \_ [mmal-vchiq]
752 ? I< 0:00 \_ [mmal-vchiq]
758 ? I< 0:00 \_ [cfg80211]
760 ? I< 0:00 \_ [brcmf_wq/mmc1:0]
761 ? S 0:00 \_ [brcmf_wdog/mmc1]
1071 ? I< 0:00 \_ [kaluad]
1072 ? I< 0:00 \_ [kmpath_rdacd]
1073 ? I< 0:00 \_ [kmpathd]
1074 ? I< 0:00 \_ [kmpath_handlerd]
1541 ? S< 0:00 \_ [loop0]
1961 ? S< 0:00 \_ [loop1]
2043 ? S< 0:00 \_ [loop2]
2580 ? I< 0:00 \_ [kworker/2:0H]
2694 ? I 0:00 \_ [kworker/0:1-events]
2701 ? I 0:00 \_ [kworker/2:2-events]
2705 ? I 0:00 \_ [kworker/3:0-events]
2739 ? I< 0:00 \_ [kworker/1:0H]
2740 ? I< 0:00 \_ [kworker/3:2H]
2741 ? I< 0:00 \_ [kworker/0:1H]
2743 ? I 0:00 \_ [kworker/1:2-mm_percpu_wq]
2753 ? I 0:00 \_ [kworker/u8:0-events_power_efficient]
2754 ? I 0:00 \_ [kworker/0:0-events]
2755 ? I 0:00 \_ [kworker/3:1-mm_percpu_wq]
2758 ? I 0:00 \_ [kworker/2:1-events_freezable]
2761 ? I< 0:00 \_ [kworker/3:0H]
2762 ? I 0:00 \_ [kworker/2:3-events]
2778 ? I< 0:00 \_ [kworker/2:2H]
2779 ? I< 0:00 \_ [kworker/1:2H]
2781 ? I 0:00 \_ [kworker/1:0-events]
2795 ? I 0:00 \_ [kworker/u8:2-events_unbound]
1 ? Ss 0:25 /sbin/init fixrtc splash
702 ? S<s 0:01 /lib/systemd/systemd-journald
729 ? Ss 0:04 /lib/systemd/systemd-udevd
1075 ? SLsl 0:01 /sbin/multipathd -d -s
1100 ? Ssl 0:01 /lib/systemd/systemd-timesyncd
1137 ? Ss 0:00 /lib/systemd/systemd-networkd
1139 ? Ss 0:01 /lib/systemd/systemd-resolved
1226 ? Ssl 0:00 /usr/lib/accountsservice/accounts-daemon
1227 ? Ss 0:03 /usr/bin/dbus-daemon --system --address=systemd: --
1230 ? Ssl 0:00 /usr/sbin/irqbalance --foreground
1232 ? Ss 0:01 /usr/bin/python3 /usr/bin/networkd-dispatcher --run
1235 ? Ssl 0:00 /usr/sbin/rsyslogd -n -iNONE
1238 ? Ss 0:01 /lib/systemd/systemd-logind
1239 ? Ss 0:00 /sbin/wpa_supplicant -u -s -O /run/wpa_supplicant
1272 ? Ss 0:00 /usr/sbin/cron -f
1276 ? Ssl 0:00 /usr/bin/python3 /usr/share/unattended-upgrades/una
1278 ? Ss 0:00 /usr/sbin/atd -f
1304 tty1 Ss+ 0:00 /sbin/agetty -o -p -- \u --noclear tty1 linux
1310 ? Ssl 0:00 /usr/lib/policykit-1/polkitd --no-debug
1826 ? Ssl 0:19 /usr/lib/snapd/snapd
2553 ? Ss 0:00 sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 star
2583 ? Ss 0:00 /bin/login -p --
2682 ttyAMA0 S 0:00 \_ -bash
2797 ttyAMA0 R+ 0:00 \_ ps axf
2676 ? Ss 0:02 /lib/systemd/systemd --user
2677 ? S 0:00 \_ (sd-pam)
+ +

cpu

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
$ dmesg | grep -i cpu
[ 0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd034]
[ 0.000000] percpu: Embedded 32 pages/cpu s92120 r8192 d30760 u131072
[ 0.000000] pcpu-alloc: s92120 r8192 d30760 u131072 alloc=32*4096
[ 0.000000] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3
[ 0.000000] Detected VIPT I-cache on CPU0
[ 0.000000] CPU features: detected: ARM erratum 845719
[ 0.000000] CPU features: kernel page table isolation forced ON by KASLR
[ 0.000000] CPU features: detected: Kernel page table isolation (KPTI)
[ 0.000000] CPU features: detected: ARM erratum 843419
[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[ 0.009272] smp: Bringing up secondary CPUs ...
[ 0.010604] Detected VIPT I-cache on CPU1
[ 0.010670] CPU1: Booted secondary processor 0x0000000001 [0x410fd034]
[ 0.012701] Detected VIPT I-cache on CPU2
[ 0.012757] CPU2: Booted secondary processor 0x0000000002 [0x410fd034]
[ 0.014581] Detected VIPT I-cache on CPU3
[ 0.014630] CPU3: Booted secondary processor 0x0000000003 [0x410fd034]
[ 0.015156] smp: Brought up 1 node, 4 CPUs
[ 0.015187] CPU features: detected: 32-bit EL0 Support
[ 0.015202] CPU features: detected: CRC32 instructions
[ 0.021521] CPU features: emulated: Privileged Access Never (PAN) using TTBR0_EL1 switching
[ 0.021534] CPU: All CPU(s) started at EL2
[ 0.057412] cpuidle: using governor ladder
[ 0.057471] cpuidle: using governor menu
[ 1.574435] cacheinfo: Unable to detect cache hierarchy for CPU 0
[ 2.549153] cpufreq: cpufreq_online: CPU0: Running at unlisted freq: 600000 KHz
[ 2.550545] cpufreq: cpufreq_online: CPU0: Unlisted initial frequency changed to: 700000 KHz
[ 2.555778] ledtrig-cpu: registered to indicate activity on CPUs
[ 2.660713] cryptd: max_cpu_qlen set to 1000
+ +

memory

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
$ free -m
total used free shared buff/cache available
Mem: 908 259 14 3 635 624
Swap: 0 0 0

$ cat /proc/meminfo
MemTotal: 929988 kB
MemFree: 15444 kB
MemAvailable: 640460 kB
Buffers: 103424 kB
Cached: 492644 kB
SwapCached: 0 kB
Active: 499704 kB
Inactive: 217952 kB
Active(anon): 131608 kB
Inactive(anon): 240 kB
Active(file): 368096 kB
Inactive(file): 217712 kB
Unevictable: 17112 kB
Mlocked: 17112 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Dirty: 744 kB
Writeback: 0 kB
AnonPages: 138700 kB
Mapped: 102852 kB
Shmem: 3980 kB
KReclaimable: 54348 kB
Slab: 106228 kB
SReclaimable: 54348 kB
SUnreclaim: 51880 kB
KernelStack: 2864 kB
PageTables: 2328 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 464992 kB
Committed_AS: 557560 kB
VmallocTotal: 135290159040 kB
VmallocUsed: 11264 kB
VmallocChunk: 0 kB
Percpu: 2336 kB
CmaTotal: 65536 kB
CmaFree: 7416 kB
+ +

disk

mmc

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$ dmesg | grep mmc
[ 2.553509] mmc-bcm2835 3f300000.mmcnr: could not get clk, deferring probe
[ 2.553816] sdhost-bcm2835 3f202000.mmc: could not get clk, deferring probe
[ 2.850835] mmc-bcm2835 3f300000.mmcnr: mmc_debug:0 mmc_debug2:0
[ 2.850856] mmc-bcm2835 3f300000.mmcnr: DMA channel allocated
[ 2.893770] mmc1: queuing unknown CIS tuple 0x80 (2 bytes)
[ 2.895411] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[ 2.897064] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[ 2.900087] mmc1: queuing unknown CIS tuple 0x80 (7 bytes)
[ 2.925168] mmc0: sdhost-bcm2835 loaded - DMA enabled (>1)
[ 2.988888] mmc0: host does not support reading read-only switch, assuming write-enable
[ 2.992217] mmc0: new high speed SDXC card at address 5048
[ 2.992857] mmc1: new high speed SDIO card at address 0001
[ 2.994317] mmcblk0: mmc0:5048 SD64G 58.2 GiB
[ 3.000050] mmcblk0: p1 p2
+ +

blkid

1
2
3
$ blkid
/dev/mmcblk0p1: LABEL_FATBOOT="system-boot" LABEL="system-boot" UUID="B726-57E2" TYPE="vfat" PARTUUID="ab86aefd-01"
/dev/mmcblk0p2: LABEL="writable" UUID="483efb12-d682-4daf-9b34-6e2f774b56f7" TYPE="ext4" PARTUUID="ab86aefd-02"
+ +

parted

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
$ sudo partprobe /dev/mmcblk0

$ sudo partx -uv /dev/mmcblk0
partition: none, disk: /dev/mmcblk0, lower: 0, upper: 0
/dev/mmcblk0: partition table type 'dos' detected
/dev/mmcblk0: partition #1 resized
/dev/mmcblk0: partition #2 resized

$ sudo parted /dev/mmcblk0 print
Model: SD SD64G (sd/mmc)
Disk /dev/mmcblk0: 62.5GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number Start End Size Type File system Flags
1 1049kB 269MB 268MB primary fat32 boot, lba
2 269MB 62.5GB 62.2GB primary ext4
+ +

gdisk

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
$ sudo gdisk -l /dev/mmcblk0
GPT fdisk (gdisk) version 1.0.5

Partition table scan:
MBR: MBR only
BSD: not present
APM: not present
GPT: not present


***************************************************************
Found invalid GPT and valid MBR; converting MBR to GPT format
in memory.
***************************************************************

Disk /dev/mmcblk0: 122093568 sectors, 58.2 GiB
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): A6CB8BCB-E18E-4A59-989E-0F8B76C7B445
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 122093534
Partitions will be aligned on 2048-sector boundaries
Total free space is 2014 sectors (1007.0 KiB)

Number Start (sector) End (sector) Size Code Name
1 2048 526335 256.0 MiB 0700 Microsoft basic data
2 526336 122093534 58.0 GiB 8300 Linux filesystem
+ +

fdisk

1
2
3
4
5
6
7
8
9
10
11
$ sudo fdisk -l /dev/mmcblk0
Disk /dev/mmcblk0: 58.22 GiB, 62511906816 bytes, 122093568 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xab86aefd

Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 * 2048 526335 524288 256M c W95 FAT32 (LBA)
/dev/mmcblk0p2 526336 122093534 121567199 58G 83 Linux
+ +

mounts

1
2
3
$ mount | grep ^/dev
/dev/mmcblk0p2 on / type ext4 (rw,relatime)
/dev/mmcblk0p1 on /boot/firmware type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)
+ +

df

1
2
3
$ df -m | grep ^/dev/mmc
/dev/mmcblk0p2 58394 2741 53239 5% /
/dev/mmcblk0p1 253 96 157 38% /boot/firmware
+ +

network

devices

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
$ ls /sys/class/net/
eth0 eth1 lo wlan0

$ ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
link/ether b8:27:eb:66:13:38 brd ff:ff:ff:ff:ff:ff
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DORMANT group default qlen 1000
link/ether b8:27:eb:33:46:6d brd ff:ff:ff:ff:ff:ff
4: eth1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN mode DEFAULT group default qlen 1000
link/ether 00:e0:4c:36:03:b4 brd ff:ff:ff:ff:ff:ff

$ dmesg | grep -Ei "eth0|lan78"
[ 2.110395] usbcore: registered new interface driver lan78xx
[ 4.717191] lan78xx 1-1.1.1:1.0 (unnamed net_device) (uninitialized): No External EEPROM. Setting MAC Speed
[ 4.719093] libphy: lan78xx-mdiobus: probed
[ 4.743714] lan78xx 1-1.1.1:1.0 (unnamed net_device) (uninitialized): int urb period 64
[ 27.317171] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready

$ dmesg | grep -Ei "eth1|r8152"
[ 1426.559659] usbcore: registered new interface driver r8152
[ 1426.804617] r8152 1-1.3.1:1.0 eth1: v1.10.11
[ 3748.647273] IPv6: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready
[ 3748.648626] r8152 1-1.3.1:1.0 eth1: carrier on

$ dmesg | grep -Ei "wlan0|brcmfmac"
[ 15.450206] brcmfmac: F1 signature read @0x18000000=0x15264345
[ 15.464369] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43455-sdio for chip BCM4345/6
[ 15.475205] usbcore: registered new interface driver brcmfmac
[ 15.802092] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43455-sdio for chip BCM4345/6
[ 15.831133] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM4345/6 wl0: Mar 2 2020 23:30:41 version 7.45.202 (r724630 CY) FWID 01-72f6ece2

filename: /lib/modules/5.4.0-1022-raspi/kernel/drivers/net/wireless/broadcom/brcm80211/brcmfmac/brcmfmac.ko
license: Dual BSD/GPL
description: Broadcom 802.11 wireless LAN fullmac driver.
author: Broadcom Corporation
firmware: brcm/brcmfmac43455-sdio.bin

$ sudo apt-get install -y rfkill wireless-tools

$ rfkill list
0: phy0: Wireless LAN
Soft blocked: no
Hard blocked: no

$ iw dev
phy#0
Interface wlan0
ifindex 3
wdev 0x1
addr b8:27:eb:33:46:6d
type managed
channel 36 (5180 MHz), width: 20 MHz, center1: 5180 MHz
txpower 31.00 dBm

$ iw reg get
global
country US: DFS-FCC
(2402 - 2472 @ 40), (N/A, 30), (N/A)
(5170 - 5250 @ 80), (N/A, 23), (N/A), AUTO-BW
(5250 - 5330 @ 80), (N/A, 23), (0 ms), DFS, AUTO-BW
(5490 - 5730 @ 160), (N/A, 23), (0 ms), DFS
(5735 - 5835 @ 80), (N/A, 30), (N/A)
(57240 - 63720 @ 2160), (N/A, 40), (N/A)

$ sudo ip link set dev wlan0 up
$ sudo iwlist wlan0 scan
+ +

ethtool

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
$ sudo ethtool -i eth0
driver: lan78xx
version: 5.8.0-1008-raspi
firmware-version:
expansion-rom-version:
bus-info: usb-3f980000.usb-1.1.1
supports-statistics: yes
supports-test: no
supports-eeprom-access: yes
supports-register-dump: yes
supports-priv-flags: no

$ sudo ethtool -i eth1
driver: r8152
version: v1.10.11
firmware-version:
expansion-rom-version:
bus-info: usb-3f980000.usb-1.3.1
supports-statistics: yes
supports-test: no
supports-eeprom-access: no
supports-register-dump: no
supports-priv-flags: no

$ sudo ethtool -i wlan0
driver: brcmfmac
version: 7.45.202
firmware-version: 01-72f6ece2
expansion-rom-version:
bus-info: mmc1:0001:1
supports-statistics: no
supports-test: no
supports-eeprom-access: no
supports-register-dump: no
supports-priv-flags: no
+ +

wpa

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# wpa_passphrase DONGSHENG-CMCC > /etc/wpa_supplicant/wpa_supplicant.conf

$ sudo /sbin/wpa_supplicant -u -s -O /run/wpa_supplicant

$ cat /etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=DIR=/run/wpa_supplicant GROUP=netdev
update_config=1
country=US

network={
ssid="my-ssid"
psk="my-psk"
scan_ssid=1
key_mgmt=WPA-PSK
}

$ sudo wpa_supplicant -B -D brcmfmac -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
$ sudo wpa_supplicant -d -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
+ +

netplan

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
$ sudo vi /etc/netplan/50-cloud-init.yaml
network:
version: 2
bonds: {}
bridges: {}
ovs_ports: {}
vlans: {}
ethernets:
eth0:
optional: true
dhcp4: true
eth1:
optional: true
dhcp4: true
wifis:
wlan0:
optional: true
dhcp4: true
access-points:
"my-ssid":
password: "my-psk"

$ sudo netplan apply
$ sudo netplan --debug apply
+ +

USB

lsusb

1
2
3
4
5
6
7
8
$ lsusb -v
$ lsusb
Bus 001 Device 006: ID 0bda:8152 Realtek Semiconductor Corp. RTL8152 Fast Ethernet Adapter
Bus 001 Device 005: ID 214b:7250
Bus 001 Device 004: ID 0424:7800 Microchip Technology, Inc. (formerly SMSC)
Bus 001 Device 003: ID 0424:2514 Microchip Technology, Inc. (formerly SMSC) USB 2.0 Hub
Bus 001 Device 002: ID 0424:2514 Microchip Technology, Inc. (formerly SMSC) USB 2.0 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
+ +

usb-devices

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
$ usb-devices

T: Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=480 MxCh= 1
D: Ver= 2.00 Cls=09(hub ) Sub=00 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=1d6b ProdID=0002 Rev=05.04
S: Manufacturer=Linux 5.4.0-1022-raspi dwc_otg_hcd
S: Product=DWC OTG Controller
S: SerialNumber=3f980000.usb
C: #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=0mA
I: If#=0x0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub

T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=480 MxCh= 4
D: Ver= 2.00 Cls=09(hub ) Sub=00 Prot=02 MxPS=64 #Cfgs= 1
P: Vendor=0424 ProdID=2514 Rev=0b.b3
C: #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=2mA
I: If#=0x0 Alt= 1 #EPs= 1 Cls=09(hub ) Sub=00 Prot=02 Driver=hub

T: Bus=01 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 3 Spd=480 MxCh= 3
D: Ver= 2.00 Cls=09(hub ) Sub=00 Prot=02 MxPS=64 #Cfgs= 1
P: Vendor=0424 ProdID=2514 Rev=0b.b3
C: #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=2mA
I: If#=0x0 Alt= 1 #EPs= 1 Cls=09(hub ) Sub=00 Prot=02 Driver=hub

T: Bus=01 Lev=03 Prnt=03 Port=00 Cnt=01 Dev#= 4 Spd=480 MxCh= 0
D: Ver= 2.10 Cls=ff(vend.) Sub=00 Prot=ff MxPS=64 #Cfgs= 1
P: Vendor=0424 ProdID=7800 Rev=03.00
C: #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=2mA
I: If#=0x0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=ff Driver=lan78xx

T: Bus=01 Lev=02 Prnt=02 Port=02 Cnt=02 Dev#= 5 Spd=480 MxCh= 4
D: Ver= 2.00 Cls=09(hub ) Sub=00 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=214b ProdID=7250 Rev=01.00
S: Product=USB2.0 HUB
C: #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=100mA
I: If#=0x0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub

T: Bus=01 Lev=03 Prnt=05 Port=00 Cnt=01 Dev#= 6 Spd=480 MxCh= 0
D: Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 2
P: Vendor=0bda ProdID=8152 Rev=20.00
S: Manufacturer=Realtek
S: Product=USB 10/100 LAN
S: SerialNumber=00E04C3603B4
C: #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr=100mA
I: If#=0x0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=00 Driver=r8152
+ +

hwloc

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
$ /usr/bin/hwloc-info
depth 0: 1 Machine (type #0)
depth 1: 1 Package (type #1)
depth 2: 4 Die (type #19)
depth 3: 4 Core (type #2)
depth 4: 4 PU (type #3)
Special depth -3: 1 NUMANode (type #13)
Special depth -6: 2 OSDev (type #16)

$ /usr/bin/lstopo
Machine (908MB total)
Package L#0
NUMANode L#0 (P#0 908MB)
Die L#0 + Core L#0 + PU L#0 (P#0)
Die L#1 + Core L#1 + PU L#1 (P#1)
Die L#2 + Core L#2 + PU L#2 (P#2)
Die L#3 + Core L#3 + PU L#3 (P#3)
Block "mmcblk0"
Net "wlan0"
+ +

hwinfo

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
$ sudo /usr/sbin/hwinfo --arch --bios --cpu --memory --disk --block --netcard --network
01: None 00.0: 10103 CPU
[Created at cpu.343]
Unique ID: rdCR.j8NaKXDZtZ6
Hardware Class: cpu
Arch: AArch64
Vendor: "ARM Limited"
Model: 0.4.0 ""
Features: fp,asimd,evtstrm,crc32,cpuid
BogoMips: 38.40
Config Status: cfg=new, avail=yes, need=no, active=unknown

02: None 00.0: 10103 CPU
[Created at cpu.343]
Unique ID: rdCR.j8NaKXDZtZ6
Hardware Class: cpu
Arch: AArch64
Vendor: "ARM Limited"
Model: 0.4.0 ""
Features: fp,asimd,evtstrm,crc32,cpuid
BogoMips: 38.40
Config Status: cfg=new, avail=yes, need=no, active=unknown

03: None 00.0: 10103 CPU
[Created at cpu.343]
Unique ID: rdCR.j8NaKXDZtZ6
Hardware Class: cpu
Arch: AArch64
Vendor: "ARM Limited"
Model: 0.4.0 ""
Features: fp,asimd,evtstrm,crc32,cpuid
BogoMips: 38.40
Config Status: cfg=new, avail=yes, need=no, active=unknown

04: None 00.0: 10103 CPU
[Created at cpu.343]
Unique ID: rdCR.j8NaKXDZtZ6
Hardware Class: cpu
Arch: AArch64
Vendor: "ARM Limited"
Model: 0.4.0 ""
Platform: "BCM2835"
Features: fp,asimd,evtstrm,crc32,cpuid
BogoMips: 38.40
Config Status: cfg=new, avail=yes, need=no, active=unknown

05: None 00.0: 10102 Main Memory
[Created at memory.74]
Unique ID: rdCR.CxwsZFjVASF
Hardware Class: memory
Model: "Main Memory"
Memory Range: 0x00000000-0x38c30fff (rw)
Memory Size: 896 MB
Config Status: cfg=new, avail=yes, need=no, active=unknown

10: SDIO 00.0: 0282 WLAN controller
[Created at pci.1939]
Unique ID: 0DfK.f_UYNWgFjo0
Parent ID: tTVG.VoJli79_k95
SysFS ID: /devices/platform/soc/3f300000.mmcnr/mmc_host/mmc1/mmc1:0001/mmc1:0001:1
SysFS BusID: mmc1:0001:1
Hardware Class: network
Model: "Broadcom BCM43430 WLAN card"
Vendor: sdio 0x02d0 "Broadcom Corp."
Device: sdio 0xa9a6 "BCM43430 WLAN card"
Driver: "brcmfmac"
Driver Modules: "brcmfmac", "brcmfmac", "brcmfmac"
Device File: wlan0
Features: WLAN
HW Address: b8:27:eb:33:46:6d
Permanent HW Address: b8:27:eb:33:46:6d
Link detected: yes
WLAN channels: 1 2 3 4 5 6 7 8 9 10 11 36 40 44 48 52 56 60 64 100 104 108 112 116 120 124 128 132 136 140 144 149
WLAN frequencies: 2.412 2.417 2.422 2.427 2.432 2.437 2.442 2.447 2.452 2.457 2.462 5.18 5.2 5.22 5.24 5.26 5.28 5.3 5.32 5.5 5.52 5.54 5.56 5.58 5.6 5.62 5.64 5.66 5.68 5.7 5.72 5.745
WLAN encryption modes: WEP40 WEP104 TKIP CCMP
WLAN authentication modes: open sharedkey wpa-psk wpa-eap
Module Alias: "sdio:c00v02D0dA9A6"
Driver Info #0:
Driver Status: brcmfmac is active
Driver Activation Cmd: "modprobe brcmfmac"
Config Status: cfg=new, avail=yes, need=no, active=unknown
Attached to: #8 (MMC Controller)

12: None 00.0: 10600 Disk
[Created at block.245]
Unique ID: HAKk.Fxp0d3BezAE
Parent ID: 924w._NN+DZ1HDn4
SysFS ID: /class/block/mmcblk0
SysFS BusID: mmc0:5048
SysFS Device Link: /devices/platform/soc/3f202000.mmc/mmc_host/mmc0/mmc0:5048
Hardware Class: disk
Model: "Disk"
Driver: "sdhost-bcm2835", "mmcblk"
Device File: /dev/mmcblk0
Device Files: /dev/mmcblk0, /dev/disk/by-path/platform-3f202000.mmc, /dev/disk/by-id/mmc-SD64G_0xda7f8e63
Device Number: block 179:0-179:31
Drive status: no medium
Config Status: cfg=new, avail=yes, need=no, active=unknown
Attached to: #7 (MMC Controller)

13: None 00.0: 11300 Partition
[Created at block.434]
Unique ID: l7UW.SE1wIdpsiiC
Parent ID: HAKk.Fxp0d3BezAE
SysFS ID: /class/block/mmcblk0/mmcblk0p1
Hardware Class: partition
Model: "Partition"
Device File: /dev/mmcblk0p1
Device Files: /dev/mmcblk0p1, /dev/disk/by-id/mmc-SD64G_0xda7f8e63-part1, /dev/disk/by-uuid/B726-57E2, /dev/disk/by-path/platform-3f202000.mmc-part1, /dev/disk/by-label/system-boot, /dev/disk/by-partuuid/ab86aefd-01
Config Status: cfg=new, avail=yes, need=no, active=unknown
Attached to: #12 (Disk)

14: None 00.0: 11300 Partition
[Created at block.434]
Unique ID: CJka.SE1wIdpsiiC
Parent ID: HAKk.Fxp0d3BezAE
SysFS ID: /class/block/mmcblk0/mmcblk0p2
Hardware Class: partition
Model: "Partition"
Device File: /dev/mmcblk0p2
Device Files: /dev/mmcblk0p2, /dev/disk/by-uuid/483efb12-d682-4daf-9b34-6e2f774b56f7, /dev/disk/by-id/mmc-SD64G_0xda7f8e63-part2, /dev/disk/by-label/writable, /dev/disk/by-path/platform-3f202000.mmc-part2, /dev/disk/by-partuuid/ab86aefd-02
Config Status: cfg=new, avail=yes, need=no, active=unknown
Attached to: #12 (Disk)

15: USB 00.0: 0200 Ethernet controller
[Created at usb.122]
Unique ID: Vl7j.8_I5RcIC_05
Parent ID: lfzD.YCWTDwYJz_B
SysFS ID: /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.1/1-1.1.1/1-1.1.1:1.0
SysFS BusID: 1-1.1.1:1.0
Hardware Class: network
Model: "Standard Microsystems Ethernet controller"
Hotplug: USB
Vendor: usb 0x0424 "Standard Microsystems Corp."
Device: usb 0x7800
Revision: "3.00"
Driver: "lan78xx"
Driver Modules: "lan78xx"
Device File: eth0
Speed: 480 Mbps
HW Address: b8:27:eb:66:13:38
Permanent HW Address: b8:27:eb:66:13:38
Link detected: yes
Module Alias: "usb:v0424p7800d0300dcFFdsc00dpFFicFFisc00ipFFin00"
Config Status: cfg=new, avail=yes, need=no, active=unknown
Attached to: #16 (Hub)

17: USB 00.0: 0200 Ethernet controller
[Created at usb.122]
Unique ID: fzDf.UulhbgwZZxD
Parent ID: dwDZ.V+vVO9032M2
SysFS ID: /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.3/1-1.3.1/1-1.3.1:1.0
SysFS BusID: 1-1.3.1:1.0
Hardware Class: network
Model: "Realtek RTL8152 Fast Ethernet Adapter"
Hotplug: USB
Vendor: usb 0x0bda "Realtek Semiconductor Corp."
Device: usb 0x8152 "RTL8152 Fast Ethernet Adapter"
Revision: "20.00"
Serial ID: "00E04C3603B4"
Driver: "r8152"
Driver Modules: "r8152"
Device File: eth1
Speed: 480 Mbps
HW Address: 00:e0:4c:36:03:b4
Permanent HW Address: 00:e0:4c:36:03:b4
Link detected: no
Module Alias: "usb:v0BDAp8152d2000dc00dsc00dp00icFFiscFFip00in00"
Driver Info #0:
Driver Status: r8152 is active
Driver Activation Cmd: "modprobe r8152"
Config Status: cfg=new, avail=yes, need=no, active=unknown
Attached to: #19 (Hub)

21: None 00.0: 10701 Ethernet
[Created at net.126]
Unique ID: usDW.ndpeucax6V1
Parent ID: Vl7j.8_I5RcIC_05
SysFS ID: /class/net/eth0
SysFS Device Link: /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.1/1-1.1.1/1-1.1.1:1.0
Hardware Class: network interface
Model: "Ethernet network interface"
Driver: "lan78xx"
Driver Modules: "lan78xx"
Device File: eth0
HW Address: b8:27:eb:66:13:38
Permanent HW Address: b8:27:eb:66:13:38
Link detected: yes
Config Status: cfg=new, avail=yes, need=no, active=unknown
Attached to: #15 (Ethernet controller)

22: None 00.0: 1070a WLAN
[Created at net.126]
Unique ID: AYEt.QXn1l67RSa1
Parent ID: 0DfK.f_UYNWgFjo0
SysFS ID: /class/net/wlan0
SysFS Device Link: /devices/platform/soc/3f300000.mmcnr/mmc_host/mmc1/mmc1:0001/mmc1:0001:1
Hardware Class: network interface
Model: "WLAN network interface"
Driver: "brcmfmac"
Driver Modules: "brcmfmac", "brcmfmac", "brcmfmac"
Device File: wlan0
HW Address: b8:27:eb:33:46:6d
Permanent HW Address: b8:27:eb:33:46:6d
Link detected: yes
Config Status: cfg=new, avail=yes, need=no, active=unknown
Attached to: #10 (WLAN controller)

23: None 01.0: 10701 Ethernet
[Created at net.126]
Unique ID: L2Ua.ndpeucax6V1
Parent ID: fzDf.UulhbgwZZxD
SysFS ID: /class/net/eth1
SysFS Device Link: /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.3/1-1.3.1/1-1.3.1:1.0
Hardware Class: network interface
Model: "Ethernet network interface"
Driver: "r8152"
Driver Modules: "r8152"
Device File: eth1
HW Address: 00:e0:4c:36:03:b4
Permanent HW Address: 00:e0:4c:36:03:b4
Link detected: no
Config Status: cfg=new, avail=yes, need=no, active=unknown
Attached to: #17 (Ethernet controller)

24: None 00.0: 10700 Loopback
[Created at net.126]
Unique ID: ZsBS.GQNx7L4uPNA
SysFS ID: /class/net/lo
Hardware Class: network interface
Model: "Loopback network interface"
Device File: lo
Link detected: yes
Config Status: cfg=new, avail=yes, need=no, active=unknown
+ +

hciconfig

1
2
3
hciconfig -a
hciconfig hci0 version
hciconfig hci0 features
+ +

bluetoothctl

1
2
3
4
5
bluetoothctl version
bluetoothctl list
bluetoothctl show
bluetoothctl devices
bluetoothctl info 9C:28:F7:97:DF:48
+ +

sysctl

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
$ sudo sysctl -a | grep ^abi | sort
abi.cp15_barrier = 2
abi.setend = 2
abi.swp = 0
abi.tagged_addr_disabled = 0

$ sudo sysctl -a | grep ^fs | sort
fs.aio-max-nr = 65536
fs.aio-nr = 0
fs.binfmt_misc.status = enabled
fs.dir-notify-enable = 1
fs.epoll.max_user_watches = 183746
fs.inotify.max_queued_events = 16384
fs.inotify.max_user_instances = 128
fs.inotify.max_user_watches = 8192
fs.lease-break-time = 45
fs.leases-enable = 1
fs.pipe-max-size = 1048576
fs.pipe-user-pages-hard = 0
fs.pipe-user-pages-soft = 16384

$ sudo sysctl -a | grep ^kernel | sort
kernel.core_pattern = |/usr/share/apport/apport %p %s %c %d %P %E
kernel.core_pipe_limit = 0
kernel.core_uses_pid = 0
kernel.watchdog = 1
kernel.watchdog_cpumask = 0-3
kernel.watchdog_thresh = 10

$ sudo sysctl -a | grep ^net | sort
net.core.bpf_jit_enable = 1
net.core.bpf_jit_harden = 0
net.core.bpf_jit_kallsyms = 0
net.core.bpf_jit_limit = 33554432
net.core.busy_poll = 0
net.core.busy_read = 0
net.core.default_qdisc = fq_codel
net.core.dev_weight = 64
net.core.dev_weight_rx_bias = 1
net.core.dev_weight_tx_bias = 1
net.core.somaxconn = 4096

$ sudo sysctl -a | grep ^user | sort
user.max_cgroup_namespaces = 3248
user.max_inotify_instances = 128
user.max_inotify_watches = 8192
user.max_ipc_namespaces = 3248
user.max_mnt_namespaces = 3248
user.max_net_namespaces = 3248
user.max_pid_namespaces = 3248
user.max_user_namespaces = 3248
user.max_uts_namespaces = 3248

$ sudo sysctl -a | grep ^vm | sort
vm.admin_reserve_kbytes = 8192
vm.dirty_background_bytes = 0
vm.dirty_background_ratio = 10
vm.dirty_bytes = 0
vm.dirty_expire_centisecs = 3000
vm.dirty_ratio = 20
vm.dirty_writeback_centisecs = 500
vm.dirtytime_expire_seconds = 43200
vm.extfrag_threshold = 500
vm.lowmem_reserve_ratio = 256 256 32 0
vm.max_map_count = 65530
vm.min_free_kbytes = 3788
vm.mmap_min_addr = 32768
vm.mmap_rnd_bits = 18
vm.mmap_rnd_compat_bits = 11
+ +

Basic configuration

OS configuration

Install packages

1
2
3
sudo apt-get update; sudo apt-get dist-upgrade -y
sudo apt-get install -y --no-install-recommends hwinfo hwloc ; \
sudo apt-get install -y --no-install-recommends rfkill wireless-tools bluez
+ +

Conclusion

It looks Ubuntu can’t found WiFi Adapter in Raspberry Pi 3 Model B Plus Rev 1.3, it’s really disappointing.

+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/12/05/ubuntu-20-04-arm64-on-raspberry-pi-3b/raspberry_pi_pins.png b/2020/12/05/ubuntu-20-04-arm64-on-raspberry-pi-3b/raspberry_pi_pins.png new file mode 100644 index 00000000..24238cc2 Binary files /dev/null and b/2020/12/05/ubuntu-20-04-arm64-on-raspberry-pi-3b/raspberry_pi_pins.png differ diff --git a/2020/12/05/ubuntu-20-04-arm64-on-raspberry-pi-3b/rpi_machine_3bplus.pdf b/2020/12/05/ubuntu-20-04-arm64-on-raspberry-pi-3b/rpi_machine_3bplus.pdf new file mode 100644 index 00000000..cafa28e7 Binary files /dev/null and b/2020/12/05/ubuntu-20-04-arm64-on-raspberry-pi-3b/rpi_machine_3bplus.pdf differ diff --git a/2020/12/05/ubuntu-20-04-arm64-on-raspberry-pi-3b/rpi_machine_3bplus.svg b/2020/12/05/ubuntu-20-04-arm64-on-raspberry-pi-3b/rpi_machine_3bplus.svg new file mode 100644 index 00000000..1748a315 --- /dev/null +++ b/2020/12/05/ubuntu-20-04-arm64-on-raspberry-pi-3b/rpi_machine_3bplus.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/2020/12/06/ubuntu-20-04-armhf-on-raspberry-pi-3b/index.html b/2020/12/06/ubuntu-20-04-armhf-on-raspberry-pi-3b/index.html new file mode 100644 index 00000000..41effc7e --- /dev/null +++ b/2020/12/06/ubuntu-20-04-armhf-on-raspberry-pi-3b/index.html @@ -0,0 +1,289 @@ + + + + + + + + + + + + Ubuntu 20.04 armhf on Raspberry Pi 3B+ | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Ubuntu 20.04 armhf on Raspberry Pi 3B+ +

+ +

Ubuntu 20.04 armhf on Raspberry Pi 3B+

Download Ubuntu image

Reference

+

Download command

1
2
3
4
$ cat << EOF | aria2c -i -
https://cdimage.ubuntu.com/releases/20.04.1/release/ubuntu-20.04.1-preinstalled-server-armhf+raspi.img.xz
https://cdimage.ubuntu.com/releases/20.04.1/release/ubuntu-20.04.1-preinstalled-server-arm64+raspi.img.xz
EOF
+ +

Integrity check

1
2
3
4
cat << EOF | sha256sum -c
aadc64a1d069c842e56a4289fe1a6b4b5a0af4efcf95bcce78eb2a80fe5270f4 ubuntu-20.04.1-preinstalled-server-arm64+raspi.img.xz
bfd1eee56f7e346e1645666fc184af854c536b3ab4e1ce49d06c266f21b1ee46 ubuntu-20.04.1-preinstalled-server-armhf+raspi.img.xz
EOF
+ +

Write image to MicroSD card

MicroSD card

1
2
3
4
$ dmesg -w
[ 0.586996] mmc0: SDHCI controller on PCI [0000:03:00.0] using ADMA
[ 3985.428729] mmc0: new high speed SDXC card at address 5048
[ 3985.439979] mmcblk0: mmc0:5048 SD64G 58.2 GiB
+ +

Write image

1
2
3
4
5
6
7
8
9
10
$ cat ubuntu-20.04.1-preinstalled-server-armhf+raspi.img.xz \
| xz -cd \
| sudo /usr/bin/time -f "\nreal\t%es\nuser\t%Us\nsys\t%Ss\n" dd of=/dev/mmcblk0 bs=4M oflag=sync status=progress
0+45620 records in
0+45620 records out
2947279872 bytes (2.9 GB, 2.7 GiB) copied, 275.276 s, 10.7 MB/s

real 275.27s
user 0.16s
sys 11.29s
+ +

parted

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
$ sudo partprobe /dev/mmcblk0

$ sudo partx -uv /dev/mmcblk0
partition: none, disk: /dev/mmcblk0, lower: 0, upper: 0
/dev/mmcblk0: partition table type 'dos' detected
/dev/mmcblk0: partition #1 added
/dev/mmcblk0: partition #2 added

$ sudo parted /dev/mmcblk0 print
Model: SD SD64G (sd/mmc)
Disk /dev/mmcblk0: 62.5GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number Start End Size Type File system Flags
1 1049kB 269MB 268MB primary fat32 boot, lba
2 269MB 2947MB 2678MB primary ext4
+ +

gdisk

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
$ sudo gdisk -l /dev/mmcblk0
GPT fdisk (gdisk) version 1.0.5

Partition table scan:
MBR: MBR only
BSD: not present
APM: not present
GPT: not present


***************************************************************
Found invalid GPT and valid MBR; converting MBR to GPT format
in memory.
***************************************************************

Disk /dev/mmcblk0: 122093568 sectors, 58.2 GiB
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): 6CA65902-4EA6-4CFC-9FCD-4009C672069D
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 122093534
Partitions will be aligned on 2048-sector boundaries
Total free space is 116339177 sectors (55.5 GiB)

Number Start (sector) End (sector) Size Code Name
1 2048 526335 256.0 MiB 0700 Microsoft basic data
2 526336 5756371 2.5 GiB 8300 Linux filesystem
+ +

fdisk

1
2
3
4
5
6
7
8
9
10
11
$ sudo fdisk -l /dev/mmcblk0
Disk /dev/mmcblk0: 58.22 GiB, 62511906816 bytes, 122093568 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xcca9935b

Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 * 2048 526335 524288 256M c W95 FAT32 (LBA)
/dev/mmcblk0p2 526336 5756371 5230036 2.5G 83 Linux
+ +

filesystem label

1
2
3
4
5
6
7
8
9
10
11
12
$ sudo fsck.vfat -a /dev/mmcblk0p1
fsck.fat 4.1 (2017-01-24)
/dev/mmcblk0p1: 254 files, 114833/516190 clusters

$ sudo dosfslabel /dev/mmcblk0p1
system-boot

$ sudo e2fsck -p /dev/mmcblk0p2
writable: clean, 74619/163520 files, 440102/653754 blocks

$ sudo e2label /dev/mmcblk0p2
writable
+ +

mmcblk

1
2
3
4
5
$ dmesg -w
[ 7620.298084] mmc0: new high speed SDXC card at address 5048
[ 7620.298269] mmcblk0: mmc0:5048 SD64G 58.2 GiB
[ 7620.323051] mmcblk0: p1 p2
[ 7620.635590] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
+ +

blkid

1
2
3
4
$ sudo blkid --info /dev/mmcblk0*
/dev/mmcblk0: MINIMUM_IO_SIZE="512" PHYSICAL_SECTOR_SIZE="512" LOGICAL_SECTOR_SIZE="512"
/dev/mmcblk0p1: MINIMUM_IO_SIZE="512" PHYSICAL_SECTOR_SIZE="512" LOGICAL_SECTOR_SIZE="512"
/dev/mmcblk0p2: MINIMUM_IO_SIZE="512" PHYSICAL_SECTOR_SIZE="512" LOGICAL_SECTOR_SIZE="512"
+ +

df

1
2
3
4
$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mmcblk0p2 2.4G 1.6G 691M 71% /media/dongsheng/writable
/dev/mmcblk0p1 253M 57M 196M 23% /media/dongsheng/system-boot
+ +

Boot configuration

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
$ cat /boot/firmware/cmdline.txt
net.ifnames=0 dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=LABEL=writable rootfstype=ext4 rootwait fixrtc earlycon=pl011,mmio32,0x3f201000

$ cat /boot/firmware/config.txt
[all]
arm_64bit=1
kernel=vmlinuz
cmdline=cmdline.txt
initramfs initrd.img followkernel

# Enable the audio output, I2C and SPI interfaces on the GPIO header
dtparam=audio=on
dtparam=i2c_arm=on
dtparam=spi=on

# Enable the serial pins
enable_uart=1
#dtoverlay=disable-bt
dtoverlay=miniuart-bt
core_freq=400
+ +

UART with USB-TTL

Pin Connectors

Raspberry Pi 3 B+ Pins

+

dmesg

1
2
3
4
5
6
7
8
9
10
11
$ dmesg -w
[ 7483.528344] usb 2-2: new full-speed USB device number 4 using xhci_hcd
[ 7483.685373] usb 2-2: New USB device found, idVendor=1a86, idProduct=7523, bcdDevice= 2.64
[ 7483.685378] usb 2-2: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[ 7483.685380] usb 2-2: Product: USB Serial
[ 7483.713970] usbcore: registered new interface driver usbserial_generic
[ 7483.713978] usbserial: USB Serial support registered for generic
[ 7483.716746] usbcore: registered new interface driver ch341
[ 7483.716759] usbserial: USB Serial support registered for ch341-uart
[ 7483.716776] ch341 2-2:1.0: ch341-uart converter detected
[ 7483.718195] usb 2-2: ch341-uart converter now attached to ttyUSB0
+ +

udev

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
$ cat /lib/udev/rules.d/60-serial.rules
# /dev/serial/by-path/, /dev/serial/by-id/ for USB devices
KERNEL!="ttyUSB[0-9]*|ttyACM[0-9]*", GOTO="serial_end"

$ /bin/udevadm info /dev/ttyUSB0
P: /devices/pci0000:00/0000:00:14.0/usb2/2-2/2-2:1.0/ttyUSB0/tty/ttyUSB0
N: ttyUSB0
L: 0
S: serial/by-id/usb-1a86_USB_Serial-if00-port0
S: serial/by-path/pci-0000:00:14.0-usb-0:2:1.0-port0
E: DEVPATH=/devices/pci0000:00/0000:00:14.0/usb2/2-2/2-2:1.0/ttyUSB0/tty/ttyUSB0
E: DEVNAME=/dev/ttyUSB0
E: MAJOR=188
E: MINOR=0
E: SUBSYSTEM=tty
E: USEC_INITIALIZED=2833769
E: ID_BUS=usb
E: ID_VENDOR_ID=1a86
E: ID_MODEL_ID=7523
E: ID_PCI_CLASS_FROM_DATABASE=Serial bus controller
E: ID_PCI_SUBCLASS_FROM_DATABASE=USB controller
E: ID_PCI_INTERFACE_FROM_DATABASE=XHCI
E: ID_VENDOR_FROM_DATABASE=QinHeng Electronics
E: ID_MODEL_FROM_DATABASE=HL-340 USB-Serial adapter
E: ID_VENDOR=1a86
E: ID_VENDOR_ENC=1a86
E: ID_MODEL=USB_Serial
E: ID_MODEL_ENC=USB\x20Serial
E: ID_REVISION=0264
E: ID_SERIAL=1a86_USB_Serial
E: ID_TYPE=generic
E: ID_USB_INTERFACES=:ff0102:
E: ID_USB_INTERFACE_NUM=00
E: ID_USB_DRIVER=ch341
E: ID_USB_CLASS_FROM_DATABASE=Vendor Specific Class
E: ID_PATH=pci-0000:00:14.0-usb-0:2:1.0
E: ID_PATH_TAG=pci-0000_00_14_0-usb-0_2_1_0
E: ID_MM_CANDIDATE=1
E: DEVLINKS=/dev/serial/by-id/usb-1a86_USB_Serial-if00-port0 /dev/serial/by-path/pci-0000:00:14.0-usb-0:2:1.0-port0
E: TAGS=:systemd:
+ +

minicom

1
$ sudo minicom -b 115200 -8 -D /dev/ttyUSB0 -t xterm
+ +

Booting Raspberry Pi

dmesg

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
$ dmesg
MMC: mmc@7e202000: 0, mmcnr@7e300000: 1
Loading Environment from FAT... *** Warning - bad CRC, using default environment

In: serial
Out: vidconsole
Err: vidconsole
Net: No ethernet found.
starting USB...
Bus usb@7e980000: scanning bus usb@7e980000 for devices... 6 USB Device(s) found
scanning usb for storage devices... 0 Storage Device(s) found
## Info: input data size = 6 = 0x6
Hit any key to stop autoboot: 0
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
Found U-Boot script /boot.scr
2569 bytes read in 4 ms (627 KiB/s)
## Executing script at 02400000
7533056 bytes read in 516 ms (13.9 MiB/s)
halfword at 0x00080000 (0x8b1f) != halfword at 0x02700000 (0x5a4d)
Total of 0 halfword(s) were the same
Copying kernel...
26433266 bytes read in 1805 ms (14 MiB/s)
Booting Ubuntu (with bootz) from mmc 0:...
Kernel image @ 0x080000 [ 0x000000 - 0x72f200 ]
## Flattened Device Tree blob at 02600000
Booting using the fdt blob at 0x2600000
Using Device Tree in place at 02600000, end 0260a2a7

Starting kernel ...


[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 5.4.0-1015-raspi (buildd@bos02-arm64-044) (gcc version 9.3.0 (Ubuntu 9.3.0-10ubuntu2)) #15-Ubuntu SMP Fri Jul 10 05:37:25 UTC 2020 (Ubuntu 5.4.0-1015.15-raspi 5.4.44)
[ 0.000000] CPU: ARMv7 Processor [410fd034] revision 4 (ARMv7), cr=30c5383d
[ 0.000000] CPU: div instructions available: patching division code
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[ 0.000000] OF: fdt: Machine model: Raspberry Pi 3 Model B Plus Rev 1.3
[ 0.000000] earlycon: pl11 at MMIO32 0x000000003f201000 (options '')
[ 0.000000] printk: bootconsole [pl11] enabled
[ 0.000000] Memory policy: Data cache writealloc
[ 0.000000] efi: Getting EFI parameters from FDT:
[ 0.000000] efi: UEFI not found.
[ 0.000000] Reserved memory: created CMA memory pool at 0x0000000037400000, size 64 MiB
[ 0.000000] OF: reserved mem: initialized node linux,cma, compatible id shared-dma-pool
[ 0.000000] On node 0 totalpages: 242688
[ 0.000000] DMA zone: 2304 pages used for memmap
[ 0.000000] DMA zone: 0 pages reserved
[ 0.000000] DMA zone: 196608 pages, LIFO batch:63
[ 0.000000] HighMem zone: 46080 pages, LIFO batch:15
[ 0.000000] percpu: Embedded 21 pages/cpu s54284 r8192 d23540 u86016
[ 0.000000] pcpu-alloc: s54284 r8192 d23540 u86016 alloc=21*4096
[ 0.000000] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 240384
[ 0.000000] Kernel command line: coherent_pool=1M 8250.nr_uarts=1 snd_bcm2835.enable_compat_alsa=0 snd_bcm2835.enable_hdmi=1 snd_bcm2835.enable_headphones=1 bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=416 bcm2708_fb.fbswap=1 vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000 net.ifnames=0 dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=LABEL=writable rootfstype=ext4 rootwait fixrtc earlycon=pl011,mmio32,0x3f201000 quiet splash
[ 0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes, linear)
[ 0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes, linear)
[ 0.000000] allocated 970752 bytes of page_ext
[ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[ 0.000000] software IO TLB: mapped [mem 0x2b2c7000-0x2f2c7000] (64MB)
[ 0.000000] Memory: 779940K/970752K available (12288K kernel code, 739K rwdata, 3788K rodata, 2048K init, 775K bss, 125276K reserved, 65536K cma-reserved, 118784K highmem)
[ 0.000000] random: get_random_u32 called from kmem_cache_open+0x30/0x3a0 with crng_init=0
[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[ 0.000000] ftrace: allocating 38313 entries in 75 pages
[ 0.000000] rcu: Hierarchical RCU implementation.
[ 0.000000] Tasks RCU enabled.
[ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
[ 0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[ 0.000000] arch_timer: cp15 timer(s) running at 19.20MHz (phys).
[ 0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x46d987e47, max_idle_ns: 440795202767 ns
[ 0.000007] sched_clock: 56 bits at 19MHz, resolution 52ns, wraps every 4398046511078ns
[ 0.000018] Switching to timer-based delay loop, resolution 52ns
[ 0.000293] Console: colour dummy device 80x30
[ 0.000315] printk: console [tty1] enabled
[ 0.000326] printk: bootconsole [pl11] disabled
[ 0.000399] Calibrating delay loop (skipped), value calculated using timer frequency.. 38.40 BogoMIPS (lpj=76800)
[ 0.000419] pid_max: default: 32768 minimum: 301
[ 0.000739] LSM: Security Framework initializing
[ 0.000818] Yama: becoming mindful.
[ 0.000989] AppArmor: AppArmor initialized
[ 0.001238] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes, linear)
[ 0.001259] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes, linear)
[ 0.001371] *** VALIDATE tmpfs ***
[ 0.002302] *** VALIDATE proc ***
[ 0.002881] Disabling memory control group subsystem
[ 0.002970] *** VALIDATE cgroup1 ***
[ 0.002984] *** VALIDATE cgroup2 ***
[ 0.003070] CPU: Testing write buffer coherency: ok
[ 0.003684] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[ 0.004784] Setting up static identity map for 0x200000 - 0x200060
[ 0.005011] rcu: Hierarchical SRCU implementation.
[ 0.008666] EFI services will not be available.
[ 0.009556] smp: Bringing up secondary CPUs ...
[ 0.011003] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
[ 0.013087] CPU2: thread -1, cpu 2, socket 0, mpidr 80000002
[ 0.014977] CPU3: thread -1, cpu 3, socket 0, mpidr 80000003
[ 0.015507] smp: Brought up 1 node, 4 CPUs
[ 0.015524] SMP: Total of 4 processors activated (153.60 BogoMIPS).
[ 0.015535] CPU: All CPU(s) started in HYP mode.
[ 0.015543] CPU: Virtualization extensions available.
[ 0.016871] devtmpfs: initialized
[ 0.034574] VFP support v0.3: implementor 41 architecture 3 part 40 variant 3 rev 4
[ 0.035209] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[ 0.035237] futex hash table entries: 1024 (order: 4, 65536 bytes, linear)
[ 0.038953] pinctrl core: initialized pinctrl subsystem
[ 0.039789] DMI not present or invalid.
[ 0.040696] NET: Registered protocol family 16
[ 0.045524] DMA: preallocated 1024 KiB pool for atomic coherent allocations
[ 0.050547] audit: initializing netlink subsys (disabled)
[ 0.050898] audit: type=2000 audit(0.048:1): state=initialized audit_enabled=0 res=1
[ 0.051749] cpuidle: using governor ladder
[ 0.051800] cpuidle: using governor menu
[ 0.052877] No ATAGs?
[ 0.053088] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers.
[ 0.053100] hw-breakpoint: maximum watchpoint size is 8 bytes.
[ 0.053556] Serial: AMBA PL011 UART driver
[ 0.056384] bcm2835-mbox 3f00b880.mailbox: mailbox enabled
[ 0.072327] raspberrypi-firmware soc:firmware: Attached to firmware from 2020-06-01 13:25, variant start
[ 0.076340] raspberrypi-firmware soc:firmware: Firmware hash is 6379679d1ec6a8c746d7e77e015f5b56b939976f
[ 0.145767] bcm2835-dma 3f007000.dma: DMA legacy API manager, dmachans=0x1
[ 0.151406] SCSI subsystem initialized
[ 0.151730] libata version 3.00 loaded.
[ 0.151987] usbcore: registered new interface driver usbfs
[ 0.152051] usbcore: registered new interface driver hub
[ 0.152209] usbcore: registered new device driver usb
[ 0.152616] pps_core: LinuxPPS API ver. 1 registered
[ 0.152627] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[ 0.152654] PTP clock support registered
[ 0.153079] EDAC MC: Ver: 3.0.0
[ 0.155194] NetLabel: Initializing
[ 0.155206] NetLabel: domain hash size = 128
[ 0.155215] NetLabel: protocols = UNLABELED CIPSOv4 CALIPSO
[ 0.155316] NetLabel: unlabeled traffic allowed by default
[ 0.156928] clocksource: Switched to clocksource arch_sys_counter
[ 0.280208] *** VALIDATE bpf ***
[ 0.280609] VFS: Disk quotas dquot_6.6.0
[ 0.280730] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[ 0.280876] *** VALIDATE ramfs ***
[ 0.281706] AppArmor: AppArmor Filesystem Enabled
[ 0.281967] simple-framebuffer 3eaf0000.framebuffer: framebuffer at 0x3eaf0000, 0x10a800 bytes, mapped to 0x(ptrval)
[ 0.281985] simple-framebuffer 3eaf0000.framebuffer: format=a8r8g8b8, mode=656x416x32, linelength=2624
[ 0.282663] Console: switching to colour frame buffer device 82x26
[ 0.287218] simple-framebuffer 3eaf0000.framebuffer: fb0: simplefb registered!
[ 0.301032] thermal_sys: Registered thermal governor 'fair_share'
[ 0.301040] thermal_sys: Registered thermal governor 'bang_bang'
[ 0.301054] thermal_sys: Registered thermal governor 'step_wise'
[ 0.301064] thermal_sys: Registered thermal governor 'user_space'
[ 0.301075] thermal_sys: Registered thermal governor 'power_allocator'
[ 0.301835] NET: Registered protocol family 2
[ 0.302808] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 6144 bytes, linear)
[ 0.302856] TCP established hash table entries: 8192 (order: 3, 32768 bytes, linear)
[ 0.302972] TCP bind hash table entries: 8192 (order: 4, 65536 bytes, linear)
[ 0.303162] TCP: Hash tables configured (established 8192 bind 8192)
[ 0.303344] UDP hash table entries: 512 (order: 2, 16384 bytes, linear)
[ 0.303398] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes, linear)
[ 0.303850] NET: Registered protocol family 1
[ 0.303887] NET: Registered protocol family 44
[ 0.303908] PCI: CLS 0 bytes, default 64
[ 0.304205] Trying to unpack rootfs image as initramfs...
[ 1.131743] Freeing initrd memory: 25816K
[ 1.132706] kvm [1]: Error, CPU 0 not supported!
[ 1.133864] hw perfevents: enabled with armv7_cortex_a7 PMU driver, 7 counters available
[ 1.138321] Initialise system trusted keyrings
[ 1.138409] Key type blacklist registered
[ 1.138712] workingset: timestamp_bits=14 max_order=18 bucket_order=4
[ 1.150449] zbud: loaded
[ 1.152962] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[ 1.154567] fuse: init (API version 7.31)
[ 1.154729] *** VALIDATE fuse ***
[ 1.154746] *** VALIDATE fuse ***
[ 1.220841] Key type asymmetric registered
[ 1.220859] Asymmetric key parser 'x509' registered
[ 1.221100] bounce: pool size: 64 pages
[ 1.221176] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 242)
[ 1.221506] io scheduler mq-deadline registered
[ 1.227352] bcm2708_fb soc:fb: FB found 1 display(s)
[ 1.232330] bcm2708_fb soc:fb: Registered framebuffer for display 0, size 656x416
[ 1.234494] raspberrypi-clk firmware-clocks: CPU frequency range: min 600000000, max 1400000000
[ 1.321309] Serial: 8250/16550 driver, 1 ports, IRQ sharing enabled
[ 1.324178] bcm2835-rng 3f104000.rng: hwrng registered
[ 1.324895] vc-mem: phys_addr:0x00000000 mem_base=0x3ec00000 mem_size:0x40000000(1024 MiB)
[ 1.325749] vc-sm: Videocore shared memory driver
[ 1.326291] gpiomem-bcm2835 3f200000.gpiomem: Initialised: Registers at 0x3f200000
[ 1.807162] loop: module loaded
[ 1.811092] spi-bcm2835 3f204000.spi: could not get clk: -517
[ 1.813734] libphy: Fixed MDIO Bus: probed
[ 1.813780] tun: Universal TUN/TAP device driver, 1.6
[ 1.814305] PPP generic driver version 2.4.2
[ 1.814622] usbcore: registered new interface driver lan78xx
[ 1.814687] usbcore: registered new interface driver smsc95xx
[ 1.814729] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 1.814758] ehci-pci: EHCI PCI platform driver
[ 1.814822] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[ 1.814961] ohci-pci: OHCI PCI platform driver
[ 1.815030] uhci_hcd: USB Universal Host Controller Interface driver
[ 1.815189] dwc_otg: version 3.00a 10-AUG-2012 (platform bus)
[ 2.015859] Core Release: 2.80a
[ 2.015873] Setting default values for core params
[ 2.015902] Finished setting default values for core params
[ 2.216272] Using Buffer DMA mode
[ 2.216283] Periodic Transfer Interrupt Enhancement - disabled
[ 2.216292] Multiprocessor Interrupt Enhancement - disabled
[ 2.216304] OTG VER PARAM: 0, OTG VER FLAG: 0
[ 2.216323] Dedicated Tx FIFOs mode
[ 2.216802] WARN::dwc_otg_hcd_init:1072: FIQ DMA bounce buffers: virt = f095c000 dma = 0x00000000f7514000 len=9024
[ 2.216832] FIQ FSM acceleration enabled for :
Non-periodic Split Transactions
Periodic Split Transactions
High-Speed Isochronous Endpoints
Interrupt/Control Split Transaction hack enabled
[ 2.216844] dwc_otg: Microframe scheduler enabled
[ 2.216974] WARN::hcd_init_fiq:457: FIQ on core 1
[ 2.216985] WARN::hcd_init_fiq:458: FIQ ASM at c09798a0 length 36
[ 2.216996] WARN::hcd_init_fiq:496: MPHI regs_base at f0810000
[ 2.217045] dwc_otg 3f980000.usb: DWC OTG Controller
[ 2.217101] dwc_otg 3f980000.usb: new USB bus registered, assigned bus number 1
[ 2.217151] dwc_otg 3f980000.usb: irq 56, io mem 0x00000000
[ 2.217203] Init: Port Power? op_state=1
[ 2.217212] Init: Power Port (0)
[ 2.217594] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.04
[ 2.217610] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[ 2.217624] usb usb1: Product: DWC OTG Controller
[ 2.217638] usb usb1: Manufacturer: Linux 5.4.0-1015-raspi dwc_otg_hcd
[ 2.217651] usb usb1: SerialNumber: 3f980000.usb
[ 2.218510] hub 1-0:1.0: USB hub found
[ 2.218579] hub 1-0:1.0: 1 port detected
[ 2.219476] dwc_otg: FIQ enabled
[ 2.219486] dwc_otg: NAK holdoff enabled
[ 2.219497] dwc_otg: FIQ split-transaction FSM enabled
[ 2.219512] Module dwc_common_port init
[ 2.220178] mousedev: PS/2 mouse device common for all mice
[ 2.221023] i2c /dev entries driver
[ 2.224747] bcm2835-wdt bcm2835-wdt: Broadcom BCM2835 watchdog timer
[ 2.225079] device-mapper: uevent: version 1.0.3
[ 2.225519] device-mapper: ioctl: 4.41.0-ioctl (2019-09-16) initialised: dm-devel@redhat.com
[ 2.226972] cpufreq: cpufreq_online: CPU0: Running at unlisted freq: 600000 KHz
[ 2.229503] cpufreq: cpufreq_online: CPU0: Unlisted initial frequency changed to: 700000 KHz
[ 2.231927] sdhci: Secure Digital Host Controller Interface driver
[ 2.231931] sdhci: Copyright(c) Pierre Ossman
[ 2.232238] mmc-bcm2835 3f300000.mmcnr: could not get clk, deferring probe
[ 2.232525] sdhost-bcm2835 3f202000.mmc: could not get clk, deferring probe
[ 2.232623] sdhci-pltfm: SDHCI platform and OF driver helper
[ 2.234444] ledtrig-cpu: registered to indicate activity on CPUs
[ 2.234528] hidraw: raw HID events driver (C) Jiri Kosina
[ 2.235106] vchiq: vchiq_init_state: slot_zero = (ptrval)
[ 2.236227] [vc_sm_connected_init]: start
[ 2.243196] [vc_sm_connected_init]: end - returning 0
[ 2.244525] drop_monitor: Initializing network drop monitor service
[ 2.245114] NET: Registered protocol family 10
[ 2.278008] Segment Routing with IPv6
[ 2.278094] NET: Registered protocol family 17
[ 2.278271] Key type dns_resolver registered
[ 2.278698] Registering SWP/SWPB emulation handler
[ 2.278964] registered taskstats version 1
[ 2.279027] Loading compiled-in X.509 certificates
[ 2.297944] Loaded X.509 cert 'Build time autogenerated kernel key: 4dd5fe50b6cf317b0a0708a187be267691ab35d9'
[ 2.298980] Key type ._fscrypt registered
[ 2.298992] Key type .fscrypt registered
[ 2.344834] cryptd: max_cpu_qlen set to 1000
[ 2.425530] Indeed it is in host mode hprt0 = 00021501
[ 2.511479] random: fast init done
[ 2.525532] Key type big_key registered
[ 2.596827] Key type encrypted registered
[ 2.596859] AppArmor: AppArmor sha1 policy hashing enabled
[ 2.596940] ima: No TPM chip found, activating TPM-bypass!
[ 2.597001] ima: Allocated hash algorithm: sha1
[ 2.597045] ima: No architecture policies found
[ 2.597130] evm: Initialising EVM extended attributes:
[ 2.597139] evm: security.selinux
[ 2.597149] evm: security.SMACK64
[ 2.597158] evm: security.SMACK64EXEC
[ 2.597167] evm: security.SMACK64TRANSMUTE
[ 2.597176] evm: security.SMACK64MMAP
[ 2.597184] evm: security.apparmor
[ 2.597193] evm: security.ima
[ 2.597202] evm: security.capability
[ 2.597212] evm: HMAC attrs: 0x1
[ 2.610181] uart-pl011 3f201000.serial: cts_event_workaround enabled
[ 2.610279] 3f201000.serial: ttyAMA0 at MMIO 0x3f201000 (irq = 81, base_baud = 0) is a PL011 rev2
[ 2.616977] usb 1-1: new high-speed USB device number 2 using dwc_otg
[ 2.620801] printk: console [ttyAMA0] enabled
[ 2.620967] Indeed it is in host mode hprt0 = 00001101
[ 2.625418] 3f215040.serial: ttyS0 at MMIO 0x0 (irq = 53, base_baud = 50000000) is a 16550
[ 2.626362] bcm2835-power bcm2835-power: Broadcom BCM2835 power domains driver
[ 2.632250] mmc-bcm2835 3f300000.mmcnr: mmc_debug:0 mmc_debug2:0
[ 2.632267] mmc-bcm2835 3f300000.mmcnr: DMA channel allocated
[ 2.674167] mmc1: queuing unknown CIS tuple 0x80 (2 bytes)
[ 2.675803] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[ 2.677438] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[ 2.680389] mmc1: queuing unknown CIS tuple 0x80 (7 bytes)
[ 2.681375] sdhost: log_buf @ (ptrval) (f7513000)
[ 2.730319] mmc0: sdhost-bcm2835 loaded - DMA enabled (>1)
[ 2.733495] hctosys: unable to open rtc device (rtc0)
[ 2.734086] of_cfs_init
[ 2.734238] of_cfs_init: OK
[ 2.755038] Freeing unused kernel memory: 2048K
[ 2.756470] Checked W+X mappings: passed, no W+X pages found
[ 2.756484] Run /init as init process
[ 2.789706] mmc0: host does not support reading read-only switch, assuming write-enable
[ 2.792751] mmc0: new high speed SDXC card at address 5048
[ 2.794113] mmcblk0: mmc0:5048 SD64G 58.2 GiB
[ 2.797311] mmc1: new high speed SDIO card at address 0001
[ 2.798079] mmcblk0: p1 p2
[ 2.829430] usb 1-1: New USB device found, idVendor=0424, idProduct=2514, bcdDevice= b.b3
[ 2.829452] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 2.830361] hub 1-1:1.0: USB hub found
[ 2.830476] hub 1-1:1.0: 4 ports detected
[ 2.888394] random: systemd-udevd: uninitialized urandom read (16 bytes read)
[ 2.895121] random: systemd-udevd: uninitialized urandom read (16 bytes read)
[ 2.895273] random: systemd-udevd: uninitialized urandom read (16 bytes read)
[ 3.117020] usb 1-1.1: new high-speed USB device number 3 using dwc_otg
[ 3.217441] usb 1-1.1: New USB device found, idVendor=0424, idProduct=2514, bcdDevice= b.b3
[ 3.217462] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 3.218478] hub 1-1.1:1.0: USB hub found
[ 3.218601] hub 1-1.1:1.0: 3 ports detected
[ 3.444994] usb 1-1.3: new high-speed USB device number 4 using dwc_otg
[ 3.545503] usb 1-1.3: New USB device found, idVendor=214b, idProduct=7250, bcdDevice= 1.00
[ 3.545524] usb 1-1.3: New USB device strings: Mfr=0, Product=1, SerialNumber=0
[ 3.545538] usb 1-1.3: Product: USB2.0 HUB
[ 3.546538] hub 1-1.3:1.0: USB hub found
[ 3.546655] hub 1-1.3:1.0: 4 ports detected
[ 3.837109] usb 1-1.3.1: new high-speed USB device number 5 using dwc_otg
[ 3.942325] usb 1-1.3.1: New USB device found, idVendor=0bda, idProduct=8152, bcdDevice=20.00
[ 3.942346] usb 1-1.3.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 3.942363] usb 1-1.3.1: Product: USB 10/100 LAN
[ 3.942377] usb 1-1.3.1: Manufacturer: Realtek
[ 3.942391] usb 1-1.3.1: SerialNumber: 00E04C3603B4
[ 4.024998] usb 1-1.1.1: new high-speed USB device number 6 using dwc_otg
[ 4.125626] usb 1-1.1.1: New USB device found, idVendor=0424, idProduct=7800, bcdDevice= 3.00
[ 4.125647] usb 1-1.1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 4.370378] usb_phy_generic phy: phy supply vcc not found, using dummy regulator
[ 4.391205] lan78xx 1-1.1.1:1.0 (unnamed net_device) (uninitialized): No External EEPROM. Setting MAC Speed
[ 4.392362] libphy: lan78xx-mdiobus: probed
[ 4.420458] lan78xx 1-1.1.1:1.0 (unnamed net_device) (uninitialized): int urb period 64
[ 8.044957] raid6: neonx8 gen() 615 MB/s
[ 8.092964] raid6: neonx8 xor() 526 MB/s
[ 8.140985] raid6: neonx4 gen() 617 MB/s
[ 8.188959] raid6: neonx4 xor() 558 MB/s
[ 8.237036] raid6: neonx2 gen() 509 MB/s
[ 8.284925] raid6: neonx2 xor() 521 MB/s
[ 8.332947] raid6: neonx1 gen() 322 MB/s
[ 8.380954] raid6: neonx1 xor() 384 MB/s
[ 8.429196] raid6: int32x8 gen() 172 MB/s
[ 8.477018] raid6: int32x8 xor() 123 MB/s
[ 8.525269] raid6: int32x4 gen() 166 MB/s
[ 8.573115] raid6: int32x4 xor() 147 MB/s
[ 8.621263] raid6: int32x2 gen() 139 MB/s
[ 8.669066] raid6: int32x2 xor() 135 MB/s
[ 8.717458] raid6: int32x1 gen() 94 MB/s
[ 8.765053] raid6: int32x1 xor() 113 MB/s
[ 8.765064] raid6: using algorithm neonx4 gen() 617 MB/s
[ 8.765074] raid6: .... xor() 558 MB/s, rmw enabled
[ 8.765084] raid6: using neon recovery algorithm
[ 8.796888] xor: measuring software checksum speed
[ 8.832932] arm4regs : 901.000 MB/sec
[ 8.872929] 8regs : 672.000 MB/sec
[ 8.912925] 32regs : 646.000 MB/sec
[ 8.952927] neon : 1071.000 MB/sec
[ 8.952938] xor: using function: neon (1071.000 MB/sec)
[ 8.963906] async_tx: api initialized (async)
[ 9.155335] uart-pl011 3f201000.serial: no DMA platform data
[ 9.586364] Btrfs loaded, crc32c=crc32c-arm-ce
[ 10.063046] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[ 11.192055] systemd[1]: Inserted module 'autofs4'
[ 11.283124] systemd[1]: systemd 245.4-4ubuntu3.2 running in system mode. (+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD +IDN2 -IDN +PCRE2 default-hierarchy=hybrid)
[ 11.284193] systemd[1]: Detected architecture arm.
[ 11.313059] systemd[1]: Set hostname to <ubuntu>.
[ 12.639072] systemd[1]: /lib/systemd/system/dbus.socket:5: ListenStream= references a path below legacy directory /var/run/, updating /var/run/dbus/system_bus_socket → /run/dbus/system_bus_socket; please update the unit file accordingly.
[ 13.235454] systemd[1]: Created slice system-modprobe.slice.
[ 13.237368] systemd[1]: Created slice system-serial\x2dgetty.slice.
[ 13.238965] systemd[1]: Created slice system-systemd\x2dfsck.slice.
[ 13.240398] systemd[1]: Created slice User and Session Slice.
[ 13.241061] systemd[1]: Started Forward Password Requests to Wall Directory Watch.
[ 13.242688] systemd[1]: Set up automount Arbitrary Executable File Formats File System Automount Point.
[ 13.243562] systemd[1]: Reached target User and Group Name Lookups.
[ 13.243802] systemd[1]: Reached target Slices.
[ 13.243981] systemd[1]: Reached target Swap.
[ 13.244724] systemd[1]: Listening on Device-mapper event daemon FIFOs.
[ 13.245751] systemd[1]: Listening on LVM2 poll daemon socket.
[ 13.246395] systemd[1]: Listening on multipathd control socket.
[ 13.247248] systemd[1]: Listening on Syslog Socket.
[ 13.248046] systemd[1]: Listening on fsck to fsckd communication Socket.
[ 13.248573] systemd[1]: Listening on initctl Compatibility Named Pipe.
[ 13.250173] systemd[1]: Listening on Journal Audit Socket.
[ 13.251008] systemd[1]: Listening on Journal Socket (/dev/log).
[ 13.251998] systemd[1]: Listening on Journal Socket.
[ 13.253203] systemd[1]: Listening on Network Service Netlink Socket.
[ 13.254109] systemd[1]: Listening on udev Control Socket.
[ 13.254754] systemd[1]: Listening on udev Kernel Socket.
[ 13.255751] systemd[1]: Condition check resulted in Huge Pages File System being skipped.
[ 13.263359] systemd[1]: Mounting POSIX Message Queue File System...
[ 13.273282] systemd[1]: Mounting Kernel Debug File System...
[ 13.282984] systemd[1]: Mounting Kernel Trace File System...
[ 13.299643] systemd[1]: Starting Journal Service...
[ 13.310226] systemd[1]: Starting Set the console keyboard layout...
[ 13.319821] systemd[1]: Starting Create list of static device nodes for the current kernel...
[ 13.329178] systemd[1]: Starting Monitoring of LVM2 mirrors, snapshots etc. using dmeventd or progress polling...
[ 13.346165] systemd[1]: Starting Load Kernel Module drm...
[ 13.352500] systemd[1]: Condition check resulted in Set Up Additional Binary Formats being skipped.
[ 13.375192] systemd[1]: Starting Load Kernel Modules...
[ 13.384679] systemd[1]: Starting Remount Root and Kernel File Systems...
[ 13.394046] systemd[1]: Starting udev Coldplug all Devices...
[ 13.403816] systemd[1]: Starting Uncomplicated firewall...
[ 13.418342] systemd[1]: Mounted POSIX Message Queue File System.
[ 13.420842] systemd[1]: Mounted Kernel Debug File System.
[ 13.423531] systemd[1]: Mounted Kernel Trace File System.
[ 13.431563] systemd[1]: Finished Create list of static device nodes for the current kernel.
[ 13.484962] systemd[1]: Finished Load Kernel Modules.
[ 13.512026] systemd[1]: Mounting FUSE Control File System...
[ 13.536860] systemd[1]: Mounting Kernel Configuration File System...
[ 13.579106] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[ 13.591285] systemd[1]: Starting Apply Kernel Variables...
[ 13.638933] systemd[1]: modprobe@drm.service: Succeeded.
[ 13.641243] systemd[1]: Finished Load Kernel Module drm.
[ 13.645516] systemd[1]: Finished Remount Root and Kernel File Systems.
[ 13.662246] systemd[1]: Finished Uncomplicated firewall.
[ 13.664186] systemd[1]: Mounted FUSE Control File System.
[ 13.666012] systemd[1]: Mounted Kernel Configuration File System.
[ 13.681202] systemd[1]: Condition check resulted in Rebuild Hardware Database being skipped.
[ 13.681606] systemd[1]: Condition check resulted in Platform Persistent Storage Archival being skipped.
[ 13.693209] systemd[1]: Starting Load/Save Random Seed...
[ 13.711056] systemd[1]: Starting Create System Users...
[ 13.769826] systemd[1]: Finished Apply Kernel Variables.
[ 13.807169] systemd[1]: Finished Load/Save Random Seed.
[ 13.819541] systemd[1]: Started Journal Service.
[ 13.873788] systemd-journald[677]: Received client request to flush runtime journal.
[ 13.894877] systemd-journald[677]: File /var/log/journal/a84f97a4ce7647ca8421d2a4eb7a3a66/system.journal corrupted or uncleanly shut down, renaming and replacing.
[ 15.196761] vc_sm_cma: module is from the staging directory, the quality is unknown, you have been warned.
[ 15.197143] vc_sm_cma: module verification failed: signature and/or required key missing - tainting kernel
[ 15.198788] bcm2835_vc_sm_cma_probe: Videocore shared memory driver
[ 15.198811] [vc_sm_connected_init]: start
[ 15.211125] [vc_sm_connected_init]: installed successfully
[ 15.310054] mc: Linux media interface: v0.10
[ 15.420494] videodev: Linux video capture interface: v2.00
[ 15.459447] snd_bcm2835: module is from the staging directory, the quality is unknown, you have been warned.
[ 15.470398] bcm2835_audio bcm2835_audio: card created with 8 channels
[ 15.635419] bcm2835_mmal_vchiq: module is from the staging directory, the quality is unknown, you have been warned.
[ 15.637101] bcm2835_mmal_vchiq: module is from the staging directory, the quality is unknown, you have been warned.
[ 15.766487] bcm2835_v4l2: module is from the staging directory, the quality is unknown, you have been warned.
[ 15.781102] bcm2835_isp: module is from the staging directory, the quality is unknown, you have been warned.
[ 15.783302] bcm2835_codec: module is from the staging directory, the quality is unknown, you have been warned.
[ 15.808308] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[ 15.815612] bcm2835-isp bcm2835-isp: Device node output[0] registered as /dev/video13
[ 15.816723] bcm2835-isp bcm2835-isp: Device node capture[0] registered as /dev/video14
[ 15.816834] bcm2835-codec bcm2835-codec: Device registered as /dev/video10
[ 15.818127] bcm2835-codec bcm2835-codec: Loaded V4L2 decode
[ 15.819074] bcm2835-isp bcm2835-isp: Device node capture[1] registered as /dev/video15
[ 15.819821] bcm2835-isp bcm2835-isp: Device node stats[2] registered as /dev/video16
[ 15.819859] bcm2835-isp bcm2835-isp: Register output node 0 with media controller
[ 15.819882] bcm2835-isp bcm2835-isp: Register capture node 1 with media controller
[ 15.819921] bcm2835-isp bcm2835-isp: Register capture node 2 with media controller
[ 15.819941] bcm2835-isp bcm2835-isp: Register capture node 3 with media controller
[ 15.820218] bcm2835-isp bcm2835-isp: Loaded V4L2 bcm2835-isp
[ 15.825684] bcm2835-codec bcm2835-codec: Device registered as /dev/video11
[ 15.825841] bcm2835-codec bcm2835-codec: Loaded V4L2 encode
[ 15.834062] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[ 15.846858] bcm2835-codec bcm2835-codec: Device registered as /dev/video12
[ 15.846910] bcm2835-codec bcm2835-codec: Loaded V4L2 isp
[ 15.902197] usbcore: registered new interface driver r8152
[ 15.981105] usb 1-1.3.1: reset high-speed USB device number 5 using dwc_otg
[ 15.996524] brcmfmac: F1 signature read @0x18000000=0x15264345
[ 16.014859] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43455-sdio for chip BCM4345/6
[ 16.020671] usbcore: registered new interface driver cdc_ether
[ 16.034064] usbcore: registered new interface driver brcmfmac
[ 16.145261] r8152 1-1.3.1:1.0 eth1: v1.10.11
[ 16.315613] Bluetooth: Core ver 2.22
[ 16.315718] NET: Registered protocol family 31
[ 16.315731] Bluetooth: HCI device and connection manager initialized
[ 16.315761] Bluetooth: HCI socket layer initialized
[ 16.315780] Bluetooth: L2CAP socket layer initialized
[ 16.315830] Bluetooth: SCO socket layer initialized
[ 16.331237] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43455-sdio for chip BCM4345/6
[ 16.369245] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM4345/6 wl0: Mar 2 2020 23:30:41 version 7.45.202 (r724630 CY) FWID 01-72f6ece2
[ 17.501212] Under-voltage detected! (0x00050005)
[ 17.731720] random: crng init done
[ 17.731743] random: 7 urandom warning(s) missed due to ratelimiting
[ 20.705137] alua: device handler registered
[ 20.717937] emc: device handler registered
[ 20.744120] rdac: device handler registered
[ 20.986476] brcmfmac: brcmf_cfg80211_set_power_mgmt: power save enabled
[ 27.215340] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
[ 30.415185] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready

[ 39.451128] EXT4-fs (mmcblk0p2): resizing filesystem from 653754 to 15195899 blocks
[ 40.117233] EXT4-fs (mmcblk0p2): resized filesystem to 15195899
+ +

First login

The default passwords for the images are ubuntu/ubuntu.

+
1
2
3
4
5
6
7
8
9
10
11
Ubuntu 20.04.1 LTS ubuntu ttyAMA0

ubuntu login: ubuntu
Password:
You are required to change your password immediately (administrator enforced)
Changing password for ubuntu.
Current password:
New password:
Retype new password:
Welcome to Ubuntu 20.04.1 LTS (GNU/Linux 5.4.0-1015-raspi armv7l)

+ +

UART

1
2
3
4
5
6
7
8
9
10
11
12
13
$ dmesg | grep -E "pl11|8250|uart|tty"
[ 0.000000] earlycon: pl11 at MMIO32 0x000000003f201000 (options '')
[ 0.000000] printk: bootconsole [pl11] enabled
[ 0.000000] Kernel command line: coherent_pool=1M 8250.nr_uarts=1 snd_bcm2835.enable_compat_alsa=0 snd_bcm2835.enable_hdmi=1 snd_bcm2835.enable_headphones=1 bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=416 bcm2708_fb.fbswap=1 vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000 net.ifnames=0 dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=LABEL=writable rootfstype=ext4 rootwait fixrtc earlycon=pl011,mmio32,0x3f201000 quiet splash
[ 0.000315] printk: console [tty1] enabled
[ 0.000326] printk: bootconsole [pl11] disabled
[ 1.321309] Serial: 8250/16550 driver, 1 ports, IRQ sharing enabled
[ 2.610181] uart-pl011 3f201000.serial: cts_event_workaround enabled
[ 2.610279] 3f201000.serial: ttyAMA0 at MMIO 0x3f201000 (irq = 81, base_baud = 0) is a PL011 rev2
[ 2.620801] printk: console [ttyAMA0] enabled
[ 2.625418] 3f215040.serial: ttyS0 at MMIO 0x0 (irq = 53, base_baud = 50000000) is a 16550
[ 9.155335] uart-pl011 3f201000.serial: no DMA platform data
[ 13.237368] systemd[1]: Created slice system-serial\x2dgetty.slice.
+ +

Setup ssh daemon

1
2
3
4
5
6
7
8
9
10
11
12
$ sudo vi /etc/ssh/sshd_config
PermitRootLogin yes
#PermitRootLogin prohibit-password

$ sudo /etc/init.d/ssh reload
Reloading ssh configuration (via systemctl): ssh.service.

$ sudo vi /etc/pam.d/sshd
# session optional pam_motd.so motd=/run/motd.dynamic

$ sudo vi /etc/pam.d/login
# session optional pam_motd.so motd=/run/motd.dynamic
+ +

System characteristics

Dimension

Raspberry Pi 3 B+ dimension

+

uname

1
2
3
4
5
$ uname -snrmp
Linux ubuntu 5.4.0-1015-raspi armv7l armv7l

$ uname -a
Linux ubuntu 5.4.0-1015-raspi #15-Ubuntu SMP Fri Jul 10 05:37:25 UTC 2020 armv7l armv7l armv7l GNU/Linux
+ +

/etc/os-release

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
$ ls -l /etc/os-release
lrwxrwxrwx 1 root root 21 Jul 15 08:59 /etc/os-release -> ../usr/lib/os-release

$ cat /usr/lib/os-release
NAME="Ubuntu"
VERSION="20.04.1 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.1 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

$ file /bin/cat
/bin/cat: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, BuildID[sha1]=0c3fc79cd78926583bcc4a853829256f1bd826d8, for GNU/Linux 3.2.0, stripped

$ ldd /bin/cat
linux-vdso.so.1 (0xbef51000)
libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0xb6ebd000)
/lib/ld-linux-armhf.so.3 (0xb6fd2000)
+ +

ps

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
$ ps axf
PID TTY STAT TIME COMMAND
2 ? S 0:00 [kthreadd]
3 ? I< 0:00 \_ [rcu_gp]
4 ? I< 0:00 \_ [rcu_par_gp]
7 ? I 0:00 \_ [kworker/u8:0-events_unbound]
8 ? I< 0:00 \_ [mm_percpu_wq]
9 ? S 0:00 \_ [ksoftirqd/0]
10 ? I 0:01 \_ [rcu_sched]
11 ? S 0:00 \_ [migration/0]
12 ? S 0:00 \_ [idle_inject/0]
13 ? I 0:00 \_ [kworker/0:1-events]
14 ? S 0:00 \_ [cpuhp/0]
15 ? S 0:00 \_ [cpuhp/1]
16 ? S 0:00 \_ [idle_inject/1]
17 ? S 0:00 \_ [migration/1]
18 ? S 0:00 \_ [ksoftirqd/1]
21 ? S 0:00 \_ [cpuhp/2]
22 ? S 0:00 \_ [idle_inject/2]
23 ? S 0:00 \_ [migration/2]
24 ? S 0:00 \_ [ksoftirqd/2]
26 ? I< 0:00 \_ [kworker/2:0H-kblockd]
27 ? S 0:00 \_ [cpuhp/3]
28 ? S 0:00 \_ [idle_inject/3]
29 ? S 0:00 \_ [migration/3]
30 ? S 0:00 \_ [ksoftirqd/3]
33 ? S 0:00 \_ [kdevtmpfs]
34 ? I< 0:00 \_ [netns]
35 ? S 0:00 \_ [rcu_tasks_kthre]
36 ? S 0:00 \_ [kauditd]
37 ? S 0:00 \_ [khungtaskd]
38 ? S 0:00 \_ [oom_reaper]
39 ? I< 0:00 \_ [writeback]
40 ? S 0:00 \_ [kcompactd0]
41 ? SN 0:00 \_ [ksmd]
78 ? I 0:00 \_ [kworker/2:1-events]
121 ? I 0:00 \_ [kworker/1:1-events_freezable]
137 ? I< 0:00 \_ [kintegrityd]
138 ? I< 0:00 \_ [kblockd]
139 ? I< 0:00 \_ [blkcg_punt_bio]
140 ? I< 0:00 \_ [tpm_dev_wq]
141 ? I< 0:00 \_ [ata_sff]
142 ? I< 0:00 \_ [md]
143 ? I< 0:00 \_ [edac-poller]
144 ? I< 0:00 \_ [devfreq_wq]
145 ? S 0:00 \_ [watchdogd]
147 ? S 0:00 \_ [kswapd0]
148 ? S 0:00 \_ [ecryptfs-kthrea]
151 ? I< 0:00 \_ [kthrotld]
152 ? I< 0:00 \_ [dwc_otg]
153 ? I< 0:00 \_ [DWC Notificatio]
155 ? S< 0:00 \_ [vchiq-slot/0]
156 ? S< 0:00 \_ [vchiq-recy/0]
157 ? S< 0:00 \_ [vchiq-sync/0]
158 ? S 0:00 \_ [vchiq-keep/0]
159 ? S< 0:00 \_ [SMIO]
160 ? I< 0:00 \_ [ipv6_addrconf]
171 ? I< 0:00 \_ [kstrp]
175 ? I< 0:00 \_ [kworker/u9:0]
178 ? I 0:00 \_ [kworker/u8:2-events_power_efficient]
179 ? I 0:00 \_ [kworker/u8:3-events_power_efficient]
182 ? I< 0:00 \_ [cryptd]
183 ? I 0:00 \_ [kworker/1:2-events]
202 ? I 0:00 \_ [kworker/2:2-events]
211 ? I 0:00 \_ [kworker/1:3-events]
212 ? S 0:00 \_ [spi0]
214 ? I< 0:00 \_ [charger_manager]
223 ? I< 0:00 \_ [mmc_complete]
224 ? I< 0:00 \_ [kworker/1:1H-kblockd]
226 ? I< 0:00 \_ [kworker/0:1H-mmc_complete]
252 ? S 0:00 \_ [irq/166-usb-001]
253 ? I< 0:00 \_ [kworker/3:1H-kblockd]
254 ? I< 0:00 \_ [kworker/3:2H]
261 ? I< 0:00 \_ [kworker/2:2H-kblockd]
262 ? I< 0:00 \_ [kworker/1:2H]
542 ? I< 0:00 \_ [raid5wq]
599 ? S 0:00 \_ [jbd2/mmcblk0p2-]
600 ? I< 0:00 \_ [ext4-rsv-conver]
632 ? I 0:00 \_ [kworker/3:2-events]
642 ? I< 0:00 \_ [kworker/0:2H]
690 ? I 0:00 \_ [kworker/3:3-events]
716 ? S< 0:00 \_ [SMIO]
720 ? I< 0:00 \_ [mmal-vchiq]
722 ? I< 0:00 \_ [mmal-vchiq]
723 ? I< 0:00 \_ [mmal-vchiq]
724 ? I< 0:00 \_ [mmal-vchiq]
734 ? I< 0:00 \_ [cfg80211]
735 ? I< 0:00 \_ [brcmf_wq/mmc1:0]
736 ? S 0:00 \_ [brcmf_wdog/mmc1]
1040 ? I< 0:00 \_ [kaluad]
1041 ? I< 0:00 \_ [kmpath_rdacd]
1042 ? I< 0:00 \_ [kmpathd]
1043 ? I< 0:00 \_ [kmpath_handlerd]
1173 ? S 0:00 \_ [ext4lazyinit]
1345 ? I 0:00 \_ [kworker/0:3-events]
1524 ? S< 0:00 \_ [loop0]
1942 ? S< 0:00 \_ [loop1]
2024 ? S< 0:00 \_ [loop2]
2554 ? I< 0:00 \_ [kworker/3:0H]
2556 ? I< 0:00 \_ [kworker/1:0H]
2557 ? I 0:00 \_ [kworker/0:0-events]
2558 ? I< 0:00 \_ [kworker/0:0H]
2652 ? I< 0:00 \_ [kworker/2:1H]
1 ? Ss 0:27 /sbin/init fixrtc splash
675 ? S<s 0:01 /lib/systemd/systemd-journald
701 ? Ss 0:03 /lib/systemd/systemd-udevd
1044 ? SLsl 0:01 /sbin/multipathd -d -s
1069 ? Ssl 0:00 /lib/systemd/systemd-timesyncd
1105 ? Ss 0:00 /lib/systemd/systemd-networkd
1107 ? Ss 0:00 /lib/systemd/systemd-resolved
1196 ? Ssl 0:00 /usr/lib/accountsservice/accounts-daemon
1197 ? Ss 0:03 /usr/bin/dbus-daemon --system --address=systemd: --no
1200 ? Ssl 0:00 /usr/sbin/irqbalance --foreground
1202 ? Ss 0:00 /usr/bin/python3 /usr/bin/networkd-dispatcher --run-s
1205 ? Ssl 0:00 /usr/sbin/rsyslogd -n -iNONE
1208 ? Ss 0:01 /lib/systemd/systemd-logind
1209 ? Ss 0:00 /sbin/wpa_supplicant -u -s -O /run/wpa_supplicant
1241 ? Ss 0:00 /usr/sbin/cron -f
1246 ? Ssl 0:00 /usr/bin/python3 /usr/share/unattended-upgrades/unatt
1247 ? Ss 0:00 /usr/sbin/atd -f
1261 tty1 Ss+ 0:00 /sbin/agetty -o -p -- \u --noclear tty1 linux
1282 ? Ssl 0:00 /usr/lib/policykit-1/polkitd --no-debug
1808 ? Ssl 0:15 /usr/lib/snapd/snapd
2527 ? Ss 0:00 sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startu
2553 ? Ss 0:00 /bin/login -p --
2660 ttyAMA0 S 0:00 \_ -bash
2671 ttyAMA0 R+ 0:00 \_ ps axf
2593 ? R 0:06 /usr/bin/python3 /usr/lib/ubuntu-release-upgrader/che
2654 ? Ss 0:03 /lib/systemd/systemd --user
2655 ? S 0:00 \_ (sd-pam)
+ +

cpu

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
$ dmesg | grep -i cpu
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] CPU: ARMv7 Processor [410fd034] revision 4 (ARMv7), cr=30c5383d
[ 0.000000] CPU: div instructions available: patching division code
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[ 0.000000] percpu: Embedded 21 pages/cpu s54284 r8192 d23540 u86016
[ 0.000000] pcpu-alloc: s54284 r8192 d23540 u86016 alloc=21*4096
[ 0.000000] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3
[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[ 0.003064] CPU: Testing write buffer coherency: ok
[ 0.003676] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[ 0.009532] smp: Bringing up secondary CPUs ...
[ 0.010966] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
[ 0.013066] CPU2: thread -1, cpu 2, socket 0, mpidr 80000002
[ 0.014954] CPU3: thread -1, cpu 3, socket 0, mpidr 80000003
[ 0.015484] smp: Brought up 1 node, 4 CPUs
[ 0.015510] CPU: All CPU(s) started in HYP mode.
[ 0.015519] CPU: Virtualization extensions available.
[ 0.051726] cpuidle: using governor ladder
[ 0.051776] cpuidle: using governor menu
[ 1.132796] kvm [1]: Error, CPU 0 not supported!
[ 1.235453] raspberrypi-clk firmware-clocks: CPU frequency range: min 600000000, max 1400000000
[ 2.227784] cpufreq: cpufreq_online: CPU0: Running at unlisted freq: 600000 KHz
[ 2.230324] cpufreq: cpufreq_online: CPU0: Unlisted initial frequency changed to: 700000 KHz
[ 2.235309] ledtrig-cpu: registered to indicate activity on CPUs
[ 2.350123] cryptd: max_cpu_qlen set to 1000
+ +

memory

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
$ free -m
total used free shared buff/cache available
Mem: 852 149 145 3 558 680
Swap: 0 0 0

$ cat /proc/meminfo
MemTotal: 873340 kB
MemFree: 147616 kB
MemAvailable: 697004 kB
Buffers: 40816 kB
Cached: 497424 kB
SwapCached: 0 kB
Active: 313752 kB
Inactive: 273144 kB
Active(anon): 56808 kB
Inactive(anon): 140 kB
Active(file): 256944 kB
Inactive(file): 273004 kB
Unevictable: 15900 kB
Mlocked: 15900 kB
HighTotal: 184320 kB
HighFree: 272 kB
LowTotal: 689020 kB
LowFree: 147344 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Dirty: 152 kB
Writeback: 0 kB
AnonPages: 64480 kB
Mapped: 78020 kB
Shmem: 3932 kB
KReclaimable: 34124 kB
Slab: 72528 kB
SReclaimable: 34124 kB
SUnreclaim: 38404 kB
KernelStack: 1344 kB
PageTables: 1540 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 436668 kB
Committed_AS: 423140 kB
VmallocTotal: 245760 kB
VmallocUsed: 6816 kB
VmallocChunk: 0 kB
Percpu: 1872 kB
CmaTotal: 65536 kB
CmaFree: 136 kB
+ +

disk

mmc

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
$ dmesg | grep mmc
[ 2.233066] mmc-bcm2835 3f300000.mmcnr: could not get clk, deferring probe
[ 2.233403] sdhost-bcm2835 3f202000.mmc: could not get clk, deferring probe
[ 2.700785] mmc-bcm2835 3f300000.mmcnr: mmc_debug:0 mmc_debug2:0
[ 2.700803] mmc-bcm2835 3f300000.mmcnr: DMA channel allocated
[ 2.765220] mmc1: queuing unknown CIS tuple 0x80 (2 bytes)
[ 2.766891] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[ 2.768551] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[ 2.771527] mmc1: queuing unknown CIS tuple 0x80 (7 bytes)
[ 2.776729] mmc0: sdhost-bcm2835 loaded - DMA enabled (>1)
[ 2.838151] mmc0: host does not support reading read-only switch, assuming write-enable
[ 2.841244] mmc0: new high speed SDXC card at address 5048
[ 2.843234] mmcblk0: mmc0:5048 SD64G 58.2 GiB
[ 2.848012] mmcblk0: p1 p2
[ 2.865151] mmc1: new high speed SDIO card at address 0001
[ 10.125543] EXT4-fs (mmcblk0p2): INFO: recovery required on readonly filesystem
[ 10.125559] EXT4-fs (mmcblk0p2): write access will be enabled during recovery
[ 10.228107] EXT4-fs (mmcblk0p2): recovery complete
[ 10.230059] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[ 13.573211] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[ 39.451128] EXT4-fs (mmcblk0p2): resizing filesystem from 653754 to 15195899 blocks
[ 40.117233] EXT4-fs (mmcblk0p2): resized filesystem to 15195899
+ +

blkid

1
2
3
$ blkid
/dev/mmcblk0p1: LABEL_FATBOOT="system-boot" LABEL="system-boot" UUID="09CD-6B98" TYPE="vfat" PARTUUID="cca9935b-01"
/dev/mmcblk0p2: LABEL="writable" UUID="e25d9784-3410-48b0-9928-acf20eecb840" TYPE="ext4" PARTUUID="cca9935b-02"
+ +

parted

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
$ sudo partprobe /dev/mmcblk0

$ sudo partx -uv /dev/mmcblk0
partition: none, disk: /dev/mmcblk0, lower: 0, upper: 0
/dev/mmcblk0: partition table type 'dos' detected
/dev/mmcblk0: partition #1 resized
/dev/mmcblk0: partition #2 resized

$ sudo parted /dev/mmcblk0 print
Model: SD SD64G (sd/mmc)
Disk /dev/mmcblk0: 62.5GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number Start End Size Type File system Flags
1 1049kB 269MB 268MB primary fat32 boot, lba
2 269MB 62.5GB 62.2GB primary ext4
+ +

gdisk

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
$ sudo gdisk -l /dev/mmcblk0
GPT fdisk (gdisk) version 1.0.5

Partition table scan:
MBR: MBR only
BSD: not present
APM: not present
GPT: not present


***************************************************************
Found invalid GPT and valid MBR; converting MBR to GPT format
in memory.
***************************************************************

Disk /dev/mmcblk0: 122093568 sectors, 58.2 GiB
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): 406FD7E9-35FF-41CB-8C2D-209C982E9E77
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 122093534
Partitions will be aligned on 2048-sector boundaries
Total free space is 2014 sectors (1007.0 KiB)

Number Start (sector) End (sector) Size Code Name
1 2048 526335 256.0 MiB 0700 Microsoft basic data
2 526336 122093534 58.0 GiB 8300 Linux filesystem
+ +

fdisk

1
2
3
4
5
6
7
8
9
10
11
$ sudo fdisk -l /dev/mmcblk0
Disk /dev/mmcblk0: 58.22 GiB, 62511906816 bytes, 122093568 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xcca9935b

Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 * 2048 526335 524288 256M c W95 FAT32 (LBA)
/dev/mmcblk0p2 526336 122093534 121567199 58G 83 Linux
+ +

mounts

1
2
3
$ mount | grep ^/dev
/dev/mmcblk0p2 on / type ext4 (rw,relatime)
/dev/mmcblk0p1 on /boot/firmware type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)
+ +

df

1
2
3
4
$ df -m | grep ^/dev/mmc
Filesystem 1M-blocks Used Available Use% Mounted on
/dev/mmcblk0p2 58365 1854 54096 4% /
/dev/mmcblk0p1 253 57 196 23% /boot/firmware
+ +

network

devices

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
$ ls /sys/class/net/
eth0 eth1 lo wlan0

$ ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
link/ether b8:27:eb:66:13:38 brd ff:ff:ff:ff:ff:ff
3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/ether 00:e0:4c:36:03:b4 brd ff:ff:ff:ff:ff:ff
4: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/ether b8:27:eb:33:46:6d brd ff:ff:ff:ff:ff:ff

$ dmesg | grep -Ei "eth0|lan78"
[ 1.815497] usbcore: registered new interface driver lan78xx
[ 4.393951] lan78xx 1-1.1.1:1.0 (unnamed net_device) (uninitialized): No External EEPROM. Setting MAC Speed
[ 4.395160] libphy: lan78xx-mdiobus: probed
[ 4.430973] lan78xx 1-1.1.1:1.0 (unnamed net_device) (uninitialized): int urb period 64
[ 31.838397] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready

$ dmesg | grep -Ei "eth1|r8152"
[ 16.012088] usbcore: registered new interface driver r8152
[ 16.324027] r8152 1-1.3.1:1.0 eth1: v1.10.11

$ dmesg | grep -Ei "wlan0|brcmfmac"
[ 16.242743] brcmfmac: F1 signature read @0x18000000=0x15264345
[ 16.252672] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43455-sdio for chip BCM4345/6
[ 16.268049] usbcore: registered new interface driver brcmfmac
[ 16.549881] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43455-sdio for chip BCM4345/6
[ 16.595297] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM4345/6 wl0: Mar 2 2020 23:30:41 version 7.45.202 (r724630 CY) FWID 01-72f6ece2
[ 1728.603723] brcmfmac: brcmf_cfg80211_set_power_mgmt: power save enabled
[ 1913.722968] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready

$ modinfo brcmfmac
filename: /lib/modules/5.4.0-1015-raspi/kernel/drivers/net/wireless/broadcom/brcm80211/brcmfmac/brcmfmac.ko
license: Dual BSD/GPL
description: Broadcom 802.11 wireless LAN fullmac driver.
author: Broadcom Corporation
firmware: brcm/brcmfmac43455-sdio.bin

$ sudo apt-get install -y --no-install-recommends rfkill wireless-tools

$ rfkill list
0: phy0: Wireless LAN
Soft blocked: no
Hard blocked: no

$ iw dev
phy#0
Unnamed/non-netdev interface
wdev 0x2
addr ca:3b:a3:50:34:9c
type P2P-device
txpower 31.00 dBm
Interface wlan0
ifindex 4
wdev 0x1
addr b8:27:eb:33:46:6d
ssid DONGSHENG-CMMC
type managed
channel 40 (5200 MHz), width: 80 MHz, center1: 5210 MHz
txpower 31.00 dBm

$ iw reg get
global
country US: DFS-FCC
(2402 - 2472 @ 40), (N/A, 30), (N/A)
(5170 - 5250 @ 80), (N/A, 23), (N/A), AUTO-BW
(5250 - 5330 @ 80), (N/A, 23), (0 ms), DFS, AUTO-BW
(5490 - 5730 @ 160), (N/A, 23), (0 ms), DFS
(5735 - 5835 @ 80), (N/A, 30), (N/A)
(57240 - 63720 @ 2160), (N/A, 40), (N/A)

$ sudo ip link set dev wlan0 up
$ sudo iwlist wlan0 scan
+ +

ethtool

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
$ sudo ethtool -i eth0
driver: lan78xx
version:
firmware-version:
expansion-rom-version:
bus-info: usb-3f980000.usb-1.1.1
supports-statistics: yes
supports-test: no
supports-eeprom-access: yes
supports-register-dump: yes
supports-priv-flags: no

$ sudo ethtool -i eth1
driver: r8152
version: v1.10.11
firmware-version:
expansion-rom-version:
bus-info: usb-3f980000.usb-1.3.1
supports-statistics: yes
supports-test: no
supports-eeprom-access: no
supports-register-dump: no
supports-priv-flags: no

$ sudo ethtool -i wlan0
driver: brcmfmac
version: 7.45.202
firmware-version: 01-72f6ece2
expansion-rom-version:
bus-info: mmc1:0001:1
supports-statistics: no
supports-test: no
supports-eeprom-access: no
supports-register-dump: no
supports-priv-flags: no
+ +

wpa

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# wpa_passphrase DONGSHENG-CMCC | sudo tee /etc/wpa_supplicant/wpa_supplicant.conf

$ sudo /sbin/wpa_supplicant -u -s -O /run/wpa_supplicant

$ cat /etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=DIR=/run/wpa_supplicant GROUP=netdev
update_config=1
country=US

network={
ssid="my-ssid"
psk="my-psk"
scan_ssid=1
key_mgmt=WPA-PSK
}

$ sudo wpa_supplicant -B -D brcmfmac -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
$ sudo wpa_supplicant -d -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
+ +

netplan

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
$ sudo vi /etc/netplan/50-cloud-init.yaml
network:
version: 2
bonds: {}
bridges: {}
ovs_ports: {}
vlans: {}
ethernets:
eth0:
optional: true
dhcp4: true
eth1:
optional: true
dhcp4: true
wifis:
wlan0:
optional: true
dhcp4: true
access-points:
"my-ssid":
password: "my-psk"

$ sudo netplan apply
$ sudo netplan --debug apply
+ +

USB

lsusb

1
2
3
4
5
6
7
8
$ lsusb -v
$ lsusb
Bus 001 Device 005: ID 0bda:8152 Realtek Semiconductor Corp. RTL8152 Fast Ethernet Adapter
Bus 001 Device 004: ID 214b:7250
Bus 001 Device 006: ID 0424:7800 Microchip Technology, Inc. (formerly SMSC)
Bus 001 Device 003: ID 0424:2514 Microchip Technology, Inc. (formerly SMSC) USB 2.0 Hub
Bus 001 Device 002: ID 0424:2514 Microchip Technology, Inc. (formerly SMSC) USB 2.0 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
+ +

usb-devices

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
$ usb-devices

T: Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=480 MxCh= 1
D: Ver= 2.00 Cls=09(hub ) Sub=00 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=1d6b ProdID=0002 Rev=05.04
S: Manufacturer=Linux 5.4.0-1015-raspi dwc_otg_hcd
S: Product=DWC OTG Controller
S: SerialNumber=3f980000.usb
C: #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=0mA
I: If#=0x0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub

T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=480 MxCh= 4
D: Ver= 2.00 Cls=09(hub ) Sub=00 Prot=02 MxPS=64 #Cfgs= 1
P: Vendor=0424 ProdID=2514 Rev=0b.b3
C: #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=2mA
I: If#=0x0 Alt= 1 #EPs= 1 Cls=09(hub ) Sub=00 Prot=02 Driver=hub

T: Bus=01 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 3 Spd=480 MxCh= 3
D: Ver= 2.00 Cls=09(hub ) Sub=00 Prot=02 MxPS=64 #Cfgs= 1
P: Vendor=0424 ProdID=2514 Rev=0b.b3
C: #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=2mA
I: If#=0x0 Alt= 1 #EPs= 1 Cls=09(hub ) Sub=00 Prot=02 Driver=hub

T: Bus=01 Lev=03 Prnt=03 Port=00 Cnt=01 Dev#= 6 Spd=480 MxCh= 0
D: Ver= 2.10 Cls=ff(vend.) Sub=00 Prot=ff MxPS=64 #Cfgs= 1
P: Vendor=0424 ProdID=7800 Rev=03.00
C: #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=2mA
I: If#=0x0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=ff Driver=lan78xx

T: Bus=01 Lev=02 Prnt=02 Port=02 Cnt=02 Dev#= 4 Spd=480 MxCh= 4
D: Ver= 2.00 Cls=09(hub ) Sub=00 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=214b ProdID=7250 Rev=01.00
S: Product=USB2.0 HUB
C: #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=100mA
I: If#=0x0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub

T: Bus=01 Lev=03 Prnt=04 Port=00 Cnt=01 Dev#= 5 Spd=480 MxCh= 0
D: Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 2
P: Vendor=0bda ProdID=8152 Rev=20.00
S: Manufacturer=Realtek
S: Product=USB 10/100 LAN
S: SerialNumber=00E04C3603B4
C: #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr=100mA
I: If#=0x0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=00 Driver=r8152
+ +

hwloc

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
$ /usr/bin/hwloc-info
depth 0: 1 Machine (type #0)
depth 1: 1 Package (type #1)
depth 2: 4 Die (type #19)
depth 3: 4 Core (type #2)
depth 4: 4 PU (type #3)
Special depth -3: 1 NUMANode (type #13)
Special depth -6: 2 OSDev (type #16)

$ /usr/bin/lstopo
Machine (853MB total)
Package L#0
NUMANode L#0 (P#0 853MB)
Die L#0 + Core L#0 + PU L#0 (P#0)
Die L#1 + Core L#1 + PU L#1 (P#1)
Die L#2 + Core L#2 + PU L#2 (P#2)
Die L#3 + Core L#3 + PU L#3 (P#3)
Block "mmcblk0"
Net "wlan0"
+ +

hwinfo

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
$ sudo /usr/sbin/hwinfo --arch --bios --cpu --memory --disk --block --netcard --network
02: None 00.0: 10103 CPU
[Created at cpu.278]
Unique ID: rdCR.j8NaKXDZtZ6
Hardware Class: cpu
Arch: ARM
Vendor: "ARM Limited"
Model: 0.4.0 ""
Platform: "BCM2835"
Features: half,thumb,fastmult,vfp,edsp,neon,vfpv3,tls,vfpv4,idiva,idivt,vfpd32,lpae,evtstrm,crc32,
BogoMips: 44.80
Config Status: cfg=new, avail=yes, need=no, active=unknown

03: None 01.0: 10103 CPU
[Created at cpu.278]
Unique ID: wkFv.j8NaKXDZtZ6
Hardware Class: cpu
Arch: ARM
Vendor: "ARM Limited"
Model: 0.4.0 ""
Platform: "BCM2835"
Features: half
BogoMips: 44.80
Config Status: cfg=new, avail=yes, need=no, active=unknown

04: None 02.0: 10103 CPU
[Created at cpu.278]
Unique ID: +rIN.j8NaKXDZtZ6
Hardware Class: cpu
Arch: ARM
Vendor: "ARM Limited"
Model: 0.4.0 ""
Platform: "BCM2835"
Features: half
BogoMips: 44.80
Config Status: cfg=new, avail=yes, need=no, active=unknown

05: None 03.0: 10103 CPU
[Created at cpu.278]
Unique ID: 4zLr.j8NaKXDZtZ6
Hardware Class: cpu
Arch: ARM
Vendor: "ARM Limited"
Model: 0.4.0 ""
Platform: "BCM2835"
Features: half
BogoMips: 44.80
Config Status: cfg=new, avail=yes, need=no, active=unknown

06: None 00.0: 10102 Main Memory
[Created at memory.74]
Unique ID: rdCR.CxwsZFjVASF
Hardware Class: memory
Model: "Main Memory"
Memory Range: 0x00000000-0x354defff (rw)
Memory Size: 832 MB
Config Status: cfg=new, avail=yes, need=no, active=unknown

11: SDIO 00.0: 0282 WLAN controller
[Created at pci.1939]
Unique ID: 0DfK.f_UYNWgFjo0
Parent ID: tTVG.VoJli79_k95
SysFS ID: /devices/platform/soc/3f300000.mmcnr/mmc_host/mmc1/mmc1:0001/mmc1:0001:1
SysFS BusID: mmc1:0001:1
Hardware Class: network
Model: "Broadcom BCM43430 WLAN card"
Vendor: sdio 0x02d0 "Broadcom Corp."
Device: sdio 0xa9a6 "BCM43430 WLAN card"
Driver: "brcmfmac"
Driver Modules: "brcmfmac", "brcmfmac", "brcmfmac"
Device File: wlan0
Features: WLAN
HW Address: b8:27:eb:33:46:6d
Permanent HW Address: b8:27:eb:33:46:6d
Link detected: yes
WLAN channels: 1 2 3 4 5 6 7 8 9 10 11 36 40 44 48 52 56 60 64 100 104 108 112 116 120 124 128 132 136 140 144 149
WLAN frequencies: 2.412 2.417 2.422 2.427 2.432 2.437 2.442 2.447 2.452 2.457 2.462 5.18 5.2 5.22 5.24 5.26 5.28 5.3 5.32 5.5 5.52 5.54 5.56 5.58 5.6 5.62 5.64 5.66 5.68 5.7 5.72 5.745
WLAN encryption modes: WEP40 WEP104 TKIP CCMP
WLAN authentication modes: open sharedkey wpa-psk wpa-eap
Module Alias: "sdio:c00v02D0dA9A6"
Driver Info #0:
Driver Status: brcmfmac is active
Driver Activation Cmd: "modprobe brcmfmac"
Config Status: cfg=new, avail=yes, need=no, active=unknown
Attached to: #8 (MMC Controller)

13: None 00.0: 10600 Disk
[Created at block.245]
Unique ID: HAKk.Fxp0d3BezAE
Parent ID: 924w._NN+DZ1HDn4
SysFS ID: /class/block/mmcblk0
SysFS BusID: mmc0:5048
SysFS Device Link: /devices/platform/soc/3f202000.mmc/mmc_host/mmc0/mmc0:5048
Hardware Class: disk
Model: "Disk"
Driver: "sdhost-bcm2835", "mmcblk"
Device File: /dev/mmcblk0
Device Files: /dev/mmcblk0, /dev/disk/by-path/platform-3f202000.mmc, /dev/disk/by-id/mmc-SD64G_0xda7f8e63
Device Number: block 179:0-179:31
Geometry (Logical): CHS 1907712/4/16
Size: 122093568 sectors a 512 bytes
Capacity: 58 GB (62511906816 bytes)
Config Status: cfg=new, avail=yes, need=no, active=unknown
Attached to: #9 (MMC Controller)

14: None 00.0: 11300 Partition
[Created at block.434]
Unique ID: l7UW.SE1wIdpsiiC
Parent ID: HAKk.Fxp0d3BezAE
SysFS ID: /class/block/mmcblk0/mmcblk0p1
Hardware Class: partition
Model: "Partition"
Device File: /dev/mmcblk0p1
Device Files: /dev/mmcblk0p1, /dev/disk/by-path/platform-3f202000.mmc-part1, /dev/disk/by-partuuid/cca9935b-01, /dev/disk/by-id/mmc-SD64G_0xda7f8e63-part1, /dev/disk/by-label/system-boot, /dev/disk/by-uuid/09CD-6B98
Config Status: cfg=new, avail=yes, need=no, active=unknown
Attached to: #13 (Disk)

15: None 00.0: 11300 Partition
[Created at block.434]
Unique ID: CJka.SE1wIdpsiiC
Parent ID: HAKk.Fxp0d3BezAE
SysFS ID: /class/block/mmcblk0/mmcblk0p2
Hardware Class: partition
Model: "Partition"
Device File: /dev/mmcblk0p2
Device Files: /dev/mmcblk0p2, /dev/disk/by-id/mmc-SD64G_0xda7f8e63-part2, /dev/disk/by-label/writable, /dev/disk/by-path/platform-3f202000.mmc-part2, /dev/disk/by-partuuid/cca9935b-02, /dev/disk/by-uuid/e25d9784-3410-48b0-9928-acf20eecb840
Config Status: cfg=new, avail=yes, need=no, active=unknown
Attached to: #13 (Disk)

16: USB 00.0: 0200 Ethernet controller
[Created at usb.122]
Unique ID: fzDf.UulhbgwZZxD
Parent ID: dwDZ.V+vVO9032M2
SysFS ID: /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.3/1-1.3.1/1-1.3.1:1.0
SysFS BusID: 1-1.3.1:1.0
Hardware Class: network
Model: "Realtek RTL8152 Fast Ethernet Adapter"
Hotplug: USB
Vendor: usb 0x0bda "Realtek Semiconductor Corp."
Device: usb 0x8152 "RTL8152 Fast Ethernet Adapter"
Revision: "20.00"
Serial ID: "00E04C3603B4"
Driver: "r8152"
Driver Modules: "r8152"
Device File: eth1
Speed: 480 Mbps
HW Address: 00:e0:4c:36:03:b4
Permanent HW Address: 00:e0:4c:36:03:b4
Link detected: no
Module Alias: "usb:v0BDAp8152d2000dc00dsc00dp00icFFiscFFip00in00"
Driver Info #0:
Driver Status: r8152 is active
Driver Activation Cmd: "modprobe r8152"
Config Status: cfg=new, avail=yes, need=no, active=unknown
Attached to: #17 (Hub)

18: USB 00.0: 0200 Ethernet controller
[Created at usb.122]
Unique ID: Vl7j.8_I5RcIC_05
Parent ID: lfzD.YCWTDwYJz_B
SysFS ID: /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.1/1-1.1.1/1-1.1.1:1.0
SysFS BusID: 1-1.1.1:1.0
Hardware Class: network
Model: "Standard Microsystems Ethernet controller"
Hotplug: USB
Vendor: usb 0x0424 "Standard Microsystems Corp."
Device: usb 0x7800
Revision: "3.00"
Driver: "lan78xx"
Driver Modules: "lan78xx"
Device File: eth0
Speed: 480 Mbps
HW Address: b8:27:eb:66:13:38
Permanent HW Address: b8:27:eb:66:13:38
Link detected: yes
Module Alias: "usb:v0424p7800d0300dcFFdsc00dpFFicFFisc00ipFFin00"
Config Status: cfg=new, avail=yes, need=no, active=unknown
Attached to: #20 (Hub)

22: None 00.0: 1070a WLAN
[Created at net.126]
Unique ID: AYEt.QXn1l67RSa1
Parent ID: 0DfK.f_UYNWgFjo0
SysFS ID: /class/net/wlan0
SysFS Device Link: /devices/platform/soc/3f300000.mmcnr/mmc_host/mmc1/mmc1:0001/mmc1:0001:1
Hardware Class: network interface
Model: "WLAN network interface"
Driver: "brcmfmac"
Driver Modules: "brcmfmac", "brcmfmac", "brcmfmac"
Device File: wlan0
HW Address: b8:27:eb:33:46:6d
Permanent HW Address: b8:27:eb:33:46:6d
Link detected: yes
Config Status: cfg=new, avail=yes, need=no, active=unknown
Attached to: #11 (WLAN controller)

23: None 00.0: 10701 Ethernet
[Created at net.126]
Unique ID: usDW.ndpeucax6V1
Parent ID: Vl7j.8_I5RcIC_05
SysFS ID: /class/net/eth0
SysFS Device Link: /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.1/1-1.1.1/1-1.1.1:1.0
Hardware Class: network interface
Model: "Ethernet network interface"
Driver: "lan78xx"
Driver Modules: "lan78xx"
Device File: eth0
HW Address: b8:27:eb:66:13:38
Permanent HW Address: b8:27:eb:66:13:38
Link detected: yes
Config Status: cfg=new, avail=yes, need=no, active=unknown
Attached to: #18 (Ethernet controller)

24: None 00.0: 10700 Loopback
[Created at net.126]
Unique ID: ZsBS.GQNx7L4uPNA
SysFS ID: /class/net/lo
Hardware Class: network interface
Model: "Loopback network interface"
Device File: lo
Link detected: yes
Config Status: cfg=new, avail=yes, need=no, active=unknown

25: None 01.0: 10701 Ethernet
[Created at net.126]
Unique ID: L2Ua.ndpeucax6V1
Parent ID: fzDf.UulhbgwZZxD
SysFS ID: /class/net/eth1
SysFS Device Link: /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.3/1-1.3.1/1-1.3.1:1.0
Hardware Class: network interface
Model: "Ethernet network interface"
Driver: "r8152"
Driver Modules: "r8152"
Device File: eth1
HW Address: 00:e0:4c:36:03:b4
Permanent HW Address: 00:e0:4c:36:03:b4
Link detected: no
Config Status: cfg=new, avail=yes, need=no, active=unknown
Attached to: #16 (Ethernet controller)
+ +

hciconfig

1
2
3
hciconfig -a
hciconfig hci0 version
hciconfig hci0 features
+ +

bluetoothctl

1
2
3
4
5
bluetoothctl version
bluetoothctl list
bluetoothctl show
bluetoothctl devices
bluetoothctl info 9C:28:F7:97:DF:48
+ +

sysctl

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
$ sudo sysctl -a | grep ^abi | sort

$ sudo sysctl -a | grep ^fs | sort
fs.aio-max-nr = 65536
fs.aio-nr = 0
fs.binfmt_misc.status = enabled
fs.dir-notify-enable = 1
fs.epoll.max_user_watches = 233436
fs.inotify.max_queued_events = 16384
fs.inotify.max_user_instances = 128
fs.inotify.max_user_watches = 8192
fs.lease-break-time = 45
fs.leases-enable = 1
fs.pipe-max-size = 1048576
fs.pipe-user-pages-hard = 0
fs.pipe-user-pages-soft = 16384

$ sudo sysctl -a | grep ^kernel | sort
kernel.core_pattern = |/usr/share/apport/apport %p %s %c %d %P %E
kernel.core_pipe_limit = 0
kernel.core_uses_pid = 0
kernel.watchdog = 1
kernel.watchdog_cpumask = 0-3
kernel.watchdog_thresh = 10

$ sudo sysctl -a | grep ^net | sort
net.core.bpf_jit_enable = 1
net.core.bpf_jit_harden = 0
net.core.bpf_jit_kallsyms = 0
net.core.bpf_jit_limit = 3670016
net.core.busy_poll = 0
net.core.busy_read = 0
net.core.default_qdisc = fq_codel
net.core.dev_weight = 64
net.core.dev_weight_rx_bias = 1
net.core.dev_weight_tx_bias = 1
net.core.somaxconn = 4096

$ sudo sysctl -a | grep ^user | sort
user.max_cgroup_namespaces = 6093
user.max_inotify_instances = 128
user.max_inotify_watches = 8192
user.max_ipc_namespaces = 6093
user.max_mnt_namespaces = 6093
user.max_net_namespaces = 6093
user.max_pid_namespaces = 6093
user.max_user_namespaces = 6093
user.max_uts_namespaces = 6093

$ sudo sysctl -a | grep ^vm | sort
vm.admin_reserve_kbytes = 8192
vm.block_dump = 0
vm.compact_unevictable_allowed = 1
vm.dirty_background_bytes = 0
vm.dirty_background_ratio = 10
vm.dirty_bytes = 0
vm.dirty_expire_centisecs = 3000
vm.dirty_ratio = 20
vm.dirtytime_expire_seconds = 43200
vm.dirty_writeback_centisecs = 500
vm.extfrag_threshold = 500
vm.lowmem_reserve_ratio = 256 32 0 0
vm.max_map_count = 65530
vm.min_free_kbytes = 3252
vm.mmap_min_addr = 32768
vm.mmap_rnd_bits = 8
+ +

Basic configuration

OS configuration

Install packages

1
2
3
sudo apt-get update; sudo apt-get dist-upgrade -y
sudo apt-get install -y --no-install-recommends hwinfo hwloc ; \
sudo apt-get install -y --no-install-recommends rfkill wireless-tools bluez
+ +

Conclusion

It looks Ubuntu can’t found WiFi Adapter in Raspberry Pi 3 Model B Plus Rev 1.3, it’s really disappointing.

+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2020/12/06/ubuntu-20-04-armhf-on-raspberry-pi-3b/raspberry_pi_pins.png b/2020/12/06/ubuntu-20-04-armhf-on-raspberry-pi-3b/raspberry_pi_pins.png new file mode 100644 index 00000000..24238cc2 Binary files /dev/null and b/2020/12/06/ubuntu-20-04-armhf-on-raspberry-pi-3b/raspberry_pi_pins.png differ diff --git a/2020/12/06/ubuntu-20-04-armhf-on-raspberry-pi-3b/rpi_machine_3bplus.pdf b/2020/12/06/ubuntu-20-04-armhf-on-raspberry-pi-3b/rpi_machine_3bplus.pdf new file mode 100644 index 00000000..cafa28e7 Binary files /dev/null and b/2020/12/06/ubuntu-20-04-armhf-on-raspberry-pi-3b/rpi_machine_3bplus.pdf differ diff --git a/2020/12/06/ubuntu-20-04-armhf-on-raspberry-pi-3b/rpi_machine_3bplus.svg b/2020/12/06/ubuntu-20-04-armhf-on-raspberry-pi-3b/rpi_machine_3bplus.svg new file mode 100644 index 00000000..1748a315 --- /dev/null +++ b/2020/12/06/ubuntu-20-04-armhf-on-raspberry-pi-3b/rpi_machine_3bplus.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/2021/01/01/20-must-have-skills-for-software-developers-in-2021/index.html b/2021/01/01/20-must-have-skills-for-software-developers-in-2021/index.html new file mode 100644 index 00000000..3007a2f0 --- /dev/null +++ b/2021/01/01/20-must-have-skills-for-software-developers-in-2021/index.html @@ -0,0 +1,221 @@ + + + + + + + + + + + + 20 Must-Have Skills for Software Developers in 2021 | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ 20 Must-Have Skills for Software Developers in 2021 +

+ +

20 Must-Have Skills for Software Developers in 2021

Whether you are already an experienced developer or just starting out, if you want to become really good in this industry, you need to constantly sharpen your skills to stay relevant. Here are some of the most valuable skills for developers to tackle this year.

+

Of course, you won’t need all of them and this list isn’t complete. But it should give you a good idea of what to learn next or what to improve on.

+

Practice Coding Every Day

Practice coding every day — even if it’s just for 30 minutes. This will help you learn the best development practices and grow your skills. It will also help you stay in top form and master new technologies.

+

Learn To Be a Good Communicator (Both Written and Spoken)

You don’t need to speak English like a native speaker, but you do need good enough communication skills to help clients understand what you are saying. Whether it’s in meetings, emails, or even on the phone, you don’t want to lose a client because they couldn’t understand your words. Also, writing clean code is an essential skill that will make you stand out from other developers.

+

Practice Object-Oriented Design Principles

Even if you just started programming, learning OOP will give you many benefits over time. It will also make it much easier for you to read other people’s code, which is essential when working with other developers and your team members.

+

Learn How To Use Version Control Systems (e.g. Git) Effectively

Version control systems are essential for any developer who works on multiple projects simultaneously or collaborates with other developers on projects. You can learn how to use Git by reading git reference.

+

Improve Your Problem-Solving Skills

Software development is a complex field. You’ll be exposed to many different problems and tasks during your career. Make sure you can solve them effectively by learning how to think like a developer.

+

Learn How To Use Design Tools Such As Photoshop, Sketch, and Illustrator

Good-looking websites and apps are essential if you want to create high-quality products that users love. While it’s possible to learn how to design using tutorials and YouTube videos, most of the time, you will need some formal training in this area when you start working on real projects.

+

Keep Learning New Technologies and Languages

Don’t get stuck on one stack! Learning new languages and frameworks will help you stay employable in this industry. If you have had the same stack for a long time, then there is a good chance that your skills will become obsolete over time. Always try to stay up to date with the newest technologies used by top developers around the world.

+

Learn at Least One Scripting Language (e.g. Python)

Scripting languages are useful for automating repetitive tasks. Even if you don’t want to become a full-time developer, scripting can make your life easier as a software engineer.

+

Learn How To Write Clean and Maintainable Code

You will have to spend lots of time reading other people’s code. If the code is not clean, then it will be very hard for you to understand what’s going on. So you must write clean and readable code yourself. One way to improve your coding skills is by writing unit tests (e.g. by using JUnit). This will help you catch bugs early in the development process. Also, try to keep your methods short so it will be easier to read them later when you need to come back and fix something in the project that you wrote months ago.

+

Be Able To Think Ahead and Plan Out How a Feature Should Work Before You Start Developing It

It takes time to go from writing an initial idea for a feature/product/bugfix to having that feature ready on the market. You need to be able to think ahead and make sure that everything fits together properly during this whole process (and also after). This includes planning with your team members, asking users what they want, talking with stakeholders about their requirements, etc. Don’t just start coding things without thinking first!

+

Learn How To Implement Security Measures Properly

There is a lot of information out there about security, and it’s easy to get confused and overwhelmed. Make sure that you don’t just focus on the obvious things like “make sure your password is strong enough” and learn more about security threats and how to fix them.

+

Don’t Be Afraid To Ask Questions

Asking questions is a great way to learn. One of the biggest mistakes you can make is to assume that you know everything. Many developers tend to think that asking for help is a sign of weakness, but it’s actually a sign of strength. If you don’t understand something, ask someone who does and then try to figure it out yourself as well. This will help you gain a deeper understanding of the topic in question.

+

Learn How To Work With Different Environments (Mac, Linux, Windows)

You don’t have to become an expert in all platforms, but you should know how they work and what their pros and cons are. Also, knowing how different development environments work will allow you to save time when switching between them. For example, developing an Android app on Windows or Mac will force you to change your workflow since the process is quite different from using Linux or Ubuntu.

+

Practice Pair Programming Regularly With Your Team Members (or Others)

Pair programming means two people working together on one computer at the same time — one person sitting behind the keyboard writing code while the other person observes and gives feedback/suggestions/code reviews, etc.

+

Pair programming has many benefits, including a better understanding of the problem domain, sharing knowledge and ideas between team members, faster debugging, etc. It also allows developers to get comfortable with each other through regular communication and helps team members build trust towards each other, which greatly improves teamwork.

+

Understand Design Patterns (SOLID Principles and Object-Oriented Design Patterns)

You don’t have to know every single pattern by heart, but understanding what they are will help you a lot as a software developer. Object-oriented design patterns are used repeatedly in different frameworks and technologies, so understanding them will be extremely useful for your job as a software developer.

+

The SOLID principles guide us when writing code:

+
    +
  • Single-responsibility principle
  • +
  • Open/closed principle
  • +
  • Liskov substitution principle
  • +
  • Interface segregation principle
  • +
  • Dependency inversion principle
  • +
+

Learn How To Deal With Change as a Software Developer

When working on new projects or even when working with existing code bases, things change from time to time (and not always because we want them to). You need to constantly adapt to these changes if you’re going to continue being productive in this business. If you cannot handle change well, you will eventually get stuck with outdated skills that won’t help you much anymore.

+

Learn How To Put Yourself in Other People’s Shoes

This is a beneficial skill in the software development industry. You need to learn how to see things through your client’s eyes and try to understand what they want or need. You need to communicate with them and make sure you deliver what they want.

+

Learn About Business Processes and Soft Skills

It doesn’t matter if you work for yourself or for another company. You must understand business processes and soft skills like communication, time management, problem-solving, and more. These are all crucial skills that will make you stand out from other developers who don’t know anything about this stuff.

+

Learn How To Deal With Deadlines

Everybody knows that projects sometimes run late and deadlines are not met. As a developer, you need to learn how to meet deadlines by setting smaller checkpoints in your projects that you can check off as you go. This will help you be more efficient and get the job done on time.

+

Learn How To Learn New Technologies Fast

As mentioned before, developers need to stay relevant and learn new technologies quickly. This means learning new languages and learning about new frameworks or libraries that can help you solve problems more efficiently. It’s not only important that you know about the technology but also why it’s better than the others.

+

If you don’t understand something or there is something that isn’t clear to you, ask questions! Don’t be afraid of looking stupid because if someone doesn’t understand something, they will never fully master it!

+

Thanks to Anupam Chugh.

+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2021/03/06/scrum-guide-2020/index.html b/2021/03/06/scrum-guide-2020/index.html new file mode 100644 index 00000000..da6f5287 --- /dev/null +++ b/2021/03/06/scrum-guide-2020/index.html @@ -0,0 +1,214 @@ + + + + + + + + + + + + Scrum Guide 2020 | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Scrum Guide 2020 +

+ +

Scrum Guide 2020

Reference

+

The new Scrum guide is shorter

If less is more then this Scrum guide is more than the last one, being considerably shorter. The reduction in length has been achieved partly by focusing on what is essential and discarding what is not. For example, the section on cancelling a sprint was four paragraphs in the old guide and is now down to two very short sentences.

+

Also, the new guide has a more open feel, there has been a change in tone throughout. A specific example: the Daily Scrum “three questions” are now gone entirely.

+

The new guide is completely industry agnostic

This was a huge emphasis in the launch event. It seems many if not most of Scrum inc. (the commercial arm of Scrum) recent clients are not software companies. The previous guide referenced product development in a general way but contained a few references that had their roots in the software world (e.g. references to testing and to releases) — the new guide has gone all in and can now offered as is to all kinds of teams (marketing teams were mentioned several times in the launch event) and within all kinds of companies.

+

The word ‘lean’ makes its debut in the new guide

“Scrum is founded on empiricism and lean thinking” is the first sentence in the “Scrum Theory” section. When discussing this Jeff Sutherland the original 1986 HBR article The New New Product Development Game by Hirotaka Takeuchi and Ikujiro Nonaka, and their connection to Japanese Lean culture. This is a big topic — for more on Lean generally take a look at Chris Lennon’s post Lean in a nutshell.

+

The structure of the guide has changed somewhat, the three artifacts now have three corresponding commitments

The previous guide had sprint goal as a mention, but not linked specifically to an event or artifact and Definition of Done was the single entry under an ‘Artifact Transparency’ section. This rather clumsy structure has been cleaned up, with the three artifacts each having a corresponding commitment.

+
    +
  • Product Backlog has a new commitment Product Goal (more on this in the next section)
  • +
  • Sprint Backlog has the commitment of the Sprint Goal
  • +
  • The Increment has the commitment of the Definition of Done
  • +
+

Product goal has been introduced (as a commitment of the Product Backlog)

This is arguably the most major change in terms of the 2020 guide content. The rationale for this change is that many teams were “doing Scrum”, with Scrum boards, product and sprint backlogs, and even an impressive velocity. However, on too many occasions teams were in fact working on features that did not connect with organizational goals. Velocity may have been high, but value was low. To combat this the concept of a Product Goal has been introduced; a value-driven outcome that the sprint goals roll up to. Only one goal should be worked on at a time, maximizing focus and limiting Work in Progress.

+

No more reference to the ‘development team’ — the Scrum team is one team

The “team within a team” wording of the previous guide is gone, the Scrum team — developers Product Owner and Scrum Master — is one team. This team is also called out as self-managing replacing the self-organizing wording of the previous guide.

+

No more references to roles — replaced by accountabilities

The word role does not appear at all in this new guide. Instead each of Scrum Master, Product Owner and Development Team have accountabilities. For more on the “roles as hats” concept see Chris Lennon’s blog Team Roles — not what they used to be.

+

Scrum master accountabilities introduced; the Scrum Master is now accountable for the Scrum Team’s effectiveness

The role of the Scrum Master has had a serious upgrade and according to the 2020 guide this role is one of a true leader and is accountable for the Scrum Team’s effectiveness. No longer a servant leader the Scrum Master is now a leader who serves.

+

The anti-pattern this change seeks to address is the case where the Scrum Master becomes a team secretary — taking and distributing meeting notes but not able to challenge effectively. I can hear the rejoicing of Scrum Masters all over the world excited by this change — time will tell if this new piece in the guide alone is able to affect meaningful change in this important area.

+

No mention of scaling frameworks

The last point I’ll make is more about what wasn’t included in the launch event than what was included. There was no mention of how to scale Scrum, no reference to Ken Schwaber’s Nexus or Jeff Sutherland’s Scrum at Scale

+

This was interesting to me, given the commercial success of the SAFe scaled agile framework. There was a comment (made by Ken or Jeff I can’t remember who) about a team framework being the key to organizational success — but the comment stopped short of saying that Scrum was all you need by way of frameworks. Jeff Sutherland in his end piece made reference to Intel and their lack of success with scaled frameworks, but if there was a point in there I missed it.

+

That’s all folks

So folks, there you have it, Scrum is 25 years old, there is a new Scrum Guide — its leaner but not meaner — a more open and empowering framework for the Scrummers out there to head into 2021 with.

+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2021/03/07/freebsd-13-summary/index.html b/2021/03/07/freebsd-13-summary/index.html new file mode 100644 index 00000000..d235916d --- /dev/null +++ b/2021/03/07/freebsd-13-summary/index.html @@ -0,0 +1,293 @@ + + + + + + + + + + + + FreeBSD 13 Summary | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ FreeBSD 13 Summary +

+ +

FreeBSD 13 Summary

FreeBSD Platforms

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Platform NamePlatform TargetSupport Tier
64-bit x86amd64Tier 1
64-bit ARMv8aarch64Tier 1
32-bit ARMv6armv6Tier 2
32-bit ARMv7armv7Tier 2
32-bit MIPS hard-floatmipshfTier 2
64-bit MIPS hard-floatmips64hfTier 2
64-bit PowerPCpowerpc64,powerpc64leTier 2
64-bit RISC-Vriscv64Tier 2
+

FreeBSD Documentation

+

FreeBSD Git Infrastructure

${repo} can be replaced by doc, ports and src. (*)

+ +

FreeBSD Download

+
1
2
3
4
5
6
7
8
9
10
$ cat << EOF | https_proxy="http://proxy.example.com:8080" aria2c -c -i -
https://download.freebsd.org/ftp/releases/ISO-IMAGES/13.0/FreeBSD-13.0-RELEASE-amd64-mini-memstick.img.xz
https://download.freebsd.org/ftp/releases/ISO-IMAGES/13.0/FreeBSD-13.0-RELEASE-arm-armv6-RPI-B.img.xz
https://download.freebsd.org/ftp/releases/ISO-IMAGES/13.0/FreeBSD-13.0-RELEASE-arm64-aarch64-mini-memstick.img.xz
https://download.freebsd.org/ftp/releases/ISO-IMAGES/13.0/FreeBSD-13.0-RELEASE-arm64-aarch64-RPI.img.xz
https://download.freebsd.org/ftp/releases/ISO-IMAGES/13.0/FreeBSD-13.0-RELEASE-riscv-riscv64-mini-memstick.img.xz
https://download.freebsd.org/ftp/releases/VM-IMAGES/13.0-RELEASE/aarch64/Latest/FreeBSD-13.0-RELEASE-arm64-aarch64.qcow2.xz
https://download.freebsd.org/ftp/releases/VM-IMAGES/13.0-RELEASE/amd64/Latest/FreeBSD-13.0-RELEASE-amd64.qcow2.xz
https://download.freebsd.org/ftp/releases/VM-IMAGES/13.0-RELEASE/riscv64/Latest/FreeBSD-13.0-RELEASE-riscv-riscv64.qcow2.xz
EOF
+ +

FreeBSD Update

+
1
2
3
4
5
6
7
8
9
10
11
12
# Based on the currently installed world and the configuration options set,
# fetch all available binary updates.
$ sudo freebsd-update fetch

# Install the most recently fetched updates or upgrade.
$ sudo freebsd-update install

# Fetch files necessary for upgrading to a new release.
$ sudo freebsd-update upgrade

# Install the most recently fetched updates or upgrade.
$ sudo freebsd-update install
+ +

Runtime Libraries and API Changes

    +
  • Removed the cap_random(3) function as it has been superseded by getrandom(2).
  • +
  • New aio_readv(2) and aio_writev(2) system calls provide vectored analogues of aio_read(2) and aio_write(2).
  • +
  • powerpc64 switched to ELFv2 ABI at the same time it switched to LLVM. This brings us to a parity with modern Linux distributions. This also makes the binaries from previous FreeBSD versions incompatible with 13.0-RELEASE.
  • +
+

Kernel Changes

    +
  • The GENERIC kernels for amd64 and i386 now include aesni(4) to support accelerated software cryptography for geli(8) by default.
  • +
  • The GENERIC kernel for aarch64 now includes armv8crypto(4) to support accelerated software cryptography for geli(8) by default. Now aarch64 supports AES-XTS and AES-GCM.
  • +
  • Added Safe Memory Reclamation (SMR) to the kernel, a light weight variant of epoch reclamation closely coupled to uma(9). This has been applied in parts of the VM subsystem and VFS layer to improve scalability on high core count systems.
  • +
  • The suite of VirtIO device drivers now support the VirtIO V1 spec. This improves FreeBSD’s compatibility as a guest operating system with various hypervisors and emulators including the ability to run on the Q35 chipset under QEMU.
  • +
  • For iscsi(4) and ctld(8), support for specifying network QoS in the form of DiffServ Codepoints (DSCP) and Ethernet Priority Code Point (PCP) was added.
  • +
  • The kernel now provides a default implementation for the SEEK_DATA and SEEK_HOLE ioctl(2)’s for filesystems which do not support sparse files.
  • +
  • The NFS client and server now support NFS over TLS. The additional userland daemons are not built by default but can be enabled by building a new world that includes a KTLS-enabled OpenSSL via the WITH_OPENSSL_KTLS option.
  • +
  • A new nfsv4_server_only variable can be set to YES in /etc/rc.conf to only enable support for NFSv4. This avoids the need to run rpcbind(8) on an NFS server.
  • +
  • The NFS client and server now support NFSv4.2 (RFC 7862) and Extended Attributes (RFC 8276).
  • +
  • The ZFS implementation is now provided by OpenZFS.
  • +
  • Updated the fusefs(5) protocol to 7.28 along with adding support for FUSE_COPY_FILE_RANGE and FUSE_LSEEK.
  • +
  • The kernel now supports in-kernel framing and encryption of Transport Layer Security (TLS) data on TCP sockets for TLS versions 1.0 through 1.3. Transmit offload via in-kernel crypto drivers is supported for MtE cipher suites using AES-CBC as well as AEAD cipher suites using AES-GCM. Receive offload via in-kernel crypto drivers is supported for AES-GCM cipher suites for TLS 1.2. Using KTLS requires the use of a KTLS-aware userland SSL library. The OpenSSL library included in the base system does not enable KTLS support by default, but support can be enabled by building with the WITH_OPENSSL_KTLS option.
  • +
  • tcp(4) now supports Proportional Rate Reduction (as described by RFC6937) to improve SACK loss recovery during burst loss and ACK thinning scenarios. This feature is enabled by default.
  • +
  • Merged the ping(8) and ping6(8) utilities. ping(8) supports both IPv4 and IPv6.
  • +
  • The amd64 architecture now supports 57-bit virtual addresses (LA57) on supported CPUs. This permits user processes to use up to** 56 bits of virtual address space**. This also includes support for five layer nested page tables used by bhyve.
  • +
  • The 64-bit ARM architecture known as arm64 or AArch64 is promoted to Tier-1 status for FreeBSD 13.
  • +
  • All powerpc architectures switched to LLVM and are currently mostly similar to amd64 toolchain-wise.
  • +
  • powerpc64le (64-bit little endian port) was introduced, targeting POWER8 and newer processors.
  • +
  • The bhyve(8) utility now supports VirtIO-9p (aka VirtFS) filesystem sharing.
  • +
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2021/03/13/haskell-programming-language/index.html b/2021/03/13/haskell-programming-language/index.html new file mode 100644 index 00000000..d5fddf1b --- /dev/null +++ b/2021/03/13/haskell-programming-language/index.html @@ -0,0 +1,620 @@ + + + + + + + + + + + + Haskell Programming Language | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Haskell Programming Language +

+ +

Haskell Programming Language

Haskell is a general-purpose, statically typed, purely functional programming language with type inference and lazy evaluation. Developed to be suitable for teaching, research and industrial application, Haskell has pioneered a number of advanced programming language features such as type classes, which enable type-safe operator overloading. Haskell’s main implementation is the Glasgow Haskell Compiler (GHC). It is named after logician Haskell Curry.

+

Features

    +
  • Statically typed
  • +
  • Purely functional
  • +
  • Type inference
  • +
  • Concurrent
  • +
  • Lazy
  • +
  • Packages
  • +
+

Overview

    +
  • GHC: A compiler and interpreter for Haskell programs.
  • +
  • Cabal: Common Architecture for Building Applications and Libraries.
  • +
  • Stack: A project builder for multi-package Haskell projects.
  • +
  • Haddock: A documentation generator for Haskell packages.
  • +
  • Hackage: The Haskell central packages repository.
  • +
  • Stackage: A curated repository of thousands of packages installed on demand.
  • +
+

Usage

Haskell has significant usage in:

+
    +
  • Web development
  • +
  • Concurrent and parallel programming
  • +
  • Cluster computing
  • +
  • Financial modeling
  • +
  • Scientific and biotech modeling
  • +
  • Parsers, compilers, type-checkers
  • +
  • Blockchain
  • +
+

Documentation

+

Download and Install

The latest (2021-03-13) LTS Haskell 17 use ghc 8.10.4, so don’t install ghc 9.0 or later if you are beginners.

+

Visual Studio Code

See Haskell Language Server (HLS), you can install from the VSCode marketplace, or manually from the repository Haskell for Visual Studio Code.

+

OS-specific packages

The OS-specific packages (eg. RPMs on Linux) are generally a better bet than the vanilla binary bundles, because they will check for dependencies and allow the package to be uninstalled at a later date.

+

e.g., install GHC 8.10.4 and cabal-install 3.4 on Debian Linux 10 (buster) amd64:

+

GHC on Debian 10

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys BA3CBA3FFE22B574
curl -sSL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xBA3CBA3FFE22B574" \
| sudo tee /etc/apt/trusted.gpg.d/downloads.haskell.org.asc

echo deb [arch=amd64] http://downloads.haskell.org/debian buster main \
| sudo tee /etc/apt/sources.list.d/haskell-buster.list
sudo apt update
sudo apt install --no-install-recommends -y aria2 autoconf automake \
build-essential ca-certificates clang cmake curl dialog fakeroot file git \
gnupg less lld llvm man-db manpages-dev ninja-build python3 sudo \
systemd-container tmux vim \
libbsd-dev libcurl4-openssl-dev libdwarf-dev libexpat1-dev libffi-dev \
libgmp-dev libjson-c-dev libjsoncpp-dev liblzma-dev libmariadb-dev \
libncurses-dev libnuma-dev libpcre2-dev libpcre3-dev libpq-dev \
librdkafka-dev libssl-dev libunwind-dev libxml2-dev libyaml-dev \
libzstd-dev zlib1g-dev

sudo apt install -y ghc-8.10.4 cabal-install-3.4
curl -sSL https://get.haskellstack.org/stable/linux-x86_64.tar.gz \
| sudo tar -xvz --strip-components=1 -C /usr/bin --wildcards */stack

export PATH=/opt/cabal/3.4/bin:/opt/ghc/8.10.4/bin:/usr/bin:/bin:/usr/sbin
+ +

Minimal installation

The Minimal installation include GHC (the compiler), build tools (primarily Cabal and Stack), and documentation generator (primarily Haddock).

+

GHC

GHC 8.10 only works with cabal-install version 3.2 or later. +GHC 9.0 only works with cabal-install version 3.4 or later. +GHC 9.2.1 will be released in June 2021 sporting Darwin/ARM support.

+ +

Cabal

+

Cabal install is done by installing them in the store and symlinking/copying the executables in the directory specified by the --installdir flag (~/.cabal/bin/ by default). If you want the installed executables to be available globally, make sure that the PATH environment variable contains that directory.

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
-- ~/.cabal/config
-- %APPDATA%\cabal\config
-- https://cabal.readthedocs.io/en/3.4/installing-packages.html
-- repository my-local-repository
-- url: file+noindex:///absolute/path/to/directory

-- WSL 1 fix: fdLock: invalid argument (Invalid argument)
-- https://github.com/haskell/cabal/issues/6551
-- constraint: lukko -ofd-locking

-- static: True
-- executable-static: True
optimization: 2
executable-stripping: True

program-default-options
-- -Werror -Wall -threaded -fPIC -static -optl-s -optl-static -optl-pthread
-- -optc-O3 -optc-ffast-math -funfolding-use-threshold=16 -haddock
ghc-options: -O2 -threaded -Wall -fPIC
+ +

Stack

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# ~/.stack/config.yaml
# %APPDATA%/stack/config.yaml
# http://docs.haskellstack.org/en/stable/yaml_configuration/
templates:
params:
author-email: songdongsheng@live.cn
author-name: 宋冬生

allow-different-user: true
local-bin-path: C:\Users\EDNGSNG\AppData\Roaming\cabal\bin

color: auto
recommend-stack-upgrade: true

system-ghc: true
install-ghc: false

compiler-check: newer-minor
allow-newer: true

ghc-options:
# -Werror -Wall -threaded -fPIC -static -optl-s -optl-static -optl-pthread
# -optc-O3 -optc-ffast-math -funfolding-use-threshold=16 -haddock
# "$locals": -O2 -threaded -Wall -fPIC
# "$targets": -O2 -threaded -Wall -fPIC
"$everything": -O2 -threaded -Wall -fPIC

connection-count: 16

package-indices:
- download-prefix: https://hackage.haskell.org/
hackage-security:
keyids:
- 0a5c7ea47cd1b15f01f5f51a33adda7e655bc0f0b0615baa8e271f4c3351e21d
- 1ea9ba32c526d1cc91ab5e5bd364ec5e9e8cb67179a471872f6e26f0ae773d42
- 280b10153a522681163658cb49f632cde3f38d768b736ddbc901d99a1a772833
- 2a96b1889dc221c17296fcc2bb34b908ca9734376f0f361660200935916ef201
- 2c6c3627bd6c982990239487f1abd02e08a02e6cf16edb105a8012d444d870c3
- 51f0161b906011b52c6613376b1ae937670da69322113a246a09f807c62f6921
- 772e9f4c7db33d251d5c6e357199c819e569d130857dc225549b40845ff0890d
- aa315286e6ad281ad61182235533c41e806e5a787e0b6d1e7eef3f09d137d2e9
- fe331502606802feac15e514d9b9ea83fee8b6ffef71335479a2e68d84adc6b0
key-threshold: 3 # number of keys required
+ +

Haddock

Haddock is a documentation generator for Haskell packages.

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
PS C:\> cabal update
PS C:\> cabal install haddock
Resolving dependencies...
Build profile: -w ghc-9.0.1 -O1
In order, the following will be built (use -v for more details):
- ghc-paths-0.1.0.12 (lib:ghc-paths) (requires download & build)
- haddock-library-1.10.0 (lib) (requires download & build)
- haddock-api-2.25.0 (lib) (requires download & build)
- haddock-2.25.0 (exe:haddock) (requires download & build)
Downloading haddock-library-1.10.0
Downloaded haddock-library-1.10.0
Downloading ghc-paths-0.1.0.12
Starting haddock-library-1.10.0 (lib)
Downloaded ghc-paths-0.1.0.12
Downloading haddock-api-2.25.0
Starting ghc-paths-0.1.0.12 (all, legacy fallback)
Downloaded haddock-api-2.25.0
Downloading haddock-2.25.0
Downloaded haddock-2.25.0
Building haddock-library-1.10.0 (lib)
Installing haddock-library-1.10.0 (lib)
Completed haddock-library-1.10.0 (lib)
Building ghc-paths-0.1.0.12 (all, legacy fallback)
Installing ghc-paths-0.1.0.12 (all, legacy fallback)
Completed ghc-paths-0.1.0.12 (all, legacy fallback)
Starting haddock-api-2.25.0 (lib)
Building haddock-api-2.25.0 (lib)
Installing haddock-api-2.25.0 (lib)
Completed haddock-api-2.25.0 (lib)
Starting haddock-2.25.0 (exe:haddock)
Building haddock-2.25.0 (exe:haddock)
Installing haddock-2.25.0 (exe:haddock)
Completed haddock-2.25.0 (exe:haddock)
Copying 'haddock.exe' to
'%APPDATA%\cabal\bin\haddock.exe'
+ +

Quick Start

Docker

+
1
2
3
4
5
6
7
8
docker run -it --rm --pull always haskell:8.10-stretch
docker run -it --rm --pull always haskell:8.10-buster

docker run -it --rm --pull always haskell:8.8-stretch
docker run -it --rm --pull always haskell:8.8-buster

docker run -it --rm --pull always fpco/stack-build:lts-16
docker run -it --rm --pull always fpco/stack-build-small:lts-16
+ +

Hello GHC

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
export PATH=/opt/ghc-8.10/bin:/bin:/usr/bin:/sbin:/usr/sbin

$ ghc --version
$ ghc --show-options
$ ghc --info

$ cat << EOF > HelloWorld.hs
module Main where
main = putStrLn "Hello, World!"
EOF

# ld.lld: error: duplicate symbol: __lll_lock_wait_private
$ rm -f HelloWorld HelloWorld.hi HelloWorld.o && \
ghc HelloWorld.hs -O2 -optl -s -optl -static \
-optl -Wl,--allow-multiple-definition

$ rm -f HelloWorld HelloWorld.hi HelloWorld.o && \
ghc HelloWorld.hs -O2 -optl -s

$ ./HelloWorld
Hello, World !

$ du -ks HelloWorld
732 HelloWorld [8.10.4]
744 HelloWorld [9.0.1]

$ file HelloWorld
HelloWorld: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked,
interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0,
BuildID[xxHash]=656ac9e0cf71b484, stripped

$ ldd HelloWorld
linux-vdso.so.1 (0x00007ffc78aa0000)
libgmp.so.10 => /lib/x86_64-linux-gnu/libgmp.so.10 (0x00007f02d43f8000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f02d4233000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f02d40ef000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f02d40e4000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f02d40de000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f02d40bc000)
/lib64/ld-linux-x86-64.so.2 (0x00007f02d4487000)
+ +

Hello Cabal

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
$ export https_proxy=http://example.com:8080

$ cabal --version
$ cabal configure
$ cabal update
$ cabal list | grep '^\*'| sort -u | wc -l
15687
$ cabal list --installed | grep '^\*'| sort -u | wc -l
259
$ ghc-pkg list | awk '{print $1}' | grep -E '^[a-zA-Z]+' | sort -u | wc -l
259

$ cabal install --lib Cabal
Resolving dependencies...
Up to date
$ cabal install --lib socket
$ cabal install hoogle
$ cabal init --minimal --exe --verbose 3
$ cabal build --enable-optimization=2 --enable-executable-stripping \
--enable-executable-static

%LOCALAPPDATA%\Programs\stack\x86_64-windows\msys2-20200903\mingw64.exe

pacman -Syuv --noconfirm
pacman -Suv --noconfirm

pacman -Ss "mingw-w64-x86_64-.*curl"

pacman -Sv --noconfirm --needed \
autoconf base-devel bsdtar diffstat git patch tar vim \
mingw-w64-x86_64-aria2 \
mingw-w64-x86_64-binutils \
mingw-w64-x86_64-ca-certificates \
mingw-w64-x86_64-ccache \
mingw-w64-x86_64-clang \
mingw-w64-x86_64-cmake \
mingw-w64-x86_64-curl \
mingw-w64-x86_64-diffutils \
mingw-w64-x86_64-gmp \
mingw-w64-x86_64-mpc \
mingw-w64-x86_64-mpfr \
mingw-w64-x86_64-libmariadbclient \
mingw-w64-x86_64-librdkafka \
mingw-w64-x86_64-libtool \
mingw-w64-x86_64-lld \
mingw-w64-x86_64-llvm \
mingw-w64-x86_64-make \
mingw-w64-x86_64-ncurses \
mingw-w64-x86_64-ninja \
mingw-w64-x86_64-openssl \
mingw-w64-x86_64-pcre \
mingw-w64-x86_64-pcre2 \
mingw-w64-x86_64-postgresql \
mingw-w64-x86_64-python \
mingw-w64-x86_64-tools-git \
mingw-w64-x86_64-xz \
mingw-w64-x86_64-zlib \
mingw-w64-x86_64-zstd

pacman -Q
pacman -Ql mingw-w64-x86_64-llvm
pacman -Qo clang-format.exe

LC_ALL=C pacman -Qi \
| awk '/^Name/{name=$3} /^Installed Size/{print $4$5, name}' \
| sort -h

$ pacman -Scc --noconfirm
$ paccache -r -k 0
+ +

Hello Stack

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
export https_proxy=http://example.com:8080

stack --version

stack config set system-ghc --global true
stack config set install-ghc --global false

stack update

stack --resolver lts --install-ghc exec -- ghc --version [8.10.4]
stack --resolver lts-17 --install-ghc exec -- ghc --version [8.10.4]
stack --resolver lts-16 --install-ghc exec -- ghc --version [8.8.4]

stack setup 8.10.4

stack setup --system-ghc --resolver lts-17.7

stack build --copy-bins hindent

stack new hello-world simple
stack ghci
stack build
stack exec my-project

stack install --resolver lts hlint hindent

stack exec ghc-pkg -- list

ghc-pkg list
ghc-pkg dot
+ +

The Stable Haskell package sets

+

Sites

+

Standard Packages

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/opt/ghc-8.10/lib/ghc-8.10.4/lib/package.conf.d
Cabal-3.2.1.0
array-0.5.4.0
base-4.14.1.0
binary-0.8.8.0
bytestring-0.10.12.0
containers-0.6.2.1
deepseq-1.4.4.0
directory-1.3.6.0
exceptions-0.10.4
filepath-1.4.2.1
ghc-8.10.4
ghc-boot-8.10.4
ghc-boot-th-8.10.4
ghc-compact-0.1.0.0
ghc-heap-8.10.4
ghc-prim-0.6.1
ghci-8.10.4
haskeline-0.8.0.1
hpc-0.6.1.0
integer-gmp-1.0.3.0
libiserv-8.10.4
mtl-2.2.2
parsec-3.1.14.0
pretty-1.1.3.6
process-1.6.9.0
rts-1.0
stm-2.5.0.0
template-haskell-2.16.0.0
terminfo-0.4.1.4
text-1.2.4.1
time-1.9.3
transformers-0.5.6.2
unix-2.7.2.2
xhtml-3000.2.2.1
+ +

Packages

    +
  • aeson: Fast JSON parsing and encoding
  • +
  • Alex: A lexical analyser generator for Haskell
  • +
  • async: Run IO operations asynchronously and wait for their results
  • +
  • attoparsec: Fast combinator parsing for bytestrings and text
  • +
  • auto-update: Efficiently run periodic, on-demand actions
  • +
  • base16-bytestring: Fast base16 (hexadecimal) encoding and decoding for Haskell bytestrings
  • +
  • base64-bytestring: Fast base64 encoding and decoding for Haskell
  • +
  • binary: Binary serialisation for Haskell values using lazy ByteStrings
  • +
  • bytestring: Fast, compact, strict and lazy byte strings with a list interface
  • +
  • conduit: Streaming data processing library
  • +
  • Conferer: Configuration managment for haskell
  • +
  • containers: Assorted concrete container types
  • +
  • cql-io: Cassandra CQL client
  • +
  • cql: cql: Cassandra CQL binary protocol
  • +
  • criterion: Robust, reliable performance measurement and analysis
  • +
  • datadog: Haskell DataDog client library
  • +
  • deepseq: Deep evaluation of data structures
  • +
  • directory: Platform-agnostic library for filesystem operations
  • +
  • fgl: A Functional Graph Library for Haskell
  • +
  • filepath: Library for manipulating FilePaths in a cross platform way
  • +
  • gauge: Lean Haskell Benchmarking
  • +
  • Happy: The Parser Generator for Haskell
  • +
  • Haxl: Simplifies access to remote data.
  • +
  • hoopl: Higher-order optimization library
  • +
  • hpack: A modern format for Haskell packages
  • +
  • hsc2hs: Haskell Pre-processor for C FFI bindings
  • +
  • hspec: A Testing Framework for Haskell
  • +
  • http-client-openssl: http-client backend using the OpenSSL library
  • +
  • http-client-tls: http-client backend using the connection package and tls library
  • +
  • http-client: An HTTP client engine
  • +
  • http-streams: An HTTP client using io-streams
  • +
  • http2: HTTP/2 library
  • +
  • hw-json: Memory efficient JSON parser
  • +
  • hw-simd: Library of simd functions
  • +
  • hw-xml: XML parser based on succinct data structures
  • +
  • inline-c: Haskell and C can be freely intermixed in the same source file
  • +
  • iproute: A Simple Routing Table Structure for CIDR
  • +
  • lens: Lenses, Folds and Traversals
  • +
  • math-functions: Special mathematical functions
  • +
  • msgpack-binary: A Haskell implementation of MessagePack
  • +
  • mime-types: Basic mime-type handling types and functions
  • +
  • mtl: The Monad Transformer Library
  • +
  • mwc-random: Fast, high quality pseudo random number generation
  • +
  • network-uri: URI manipulation facilities
  • +
  • network: Low-level networking interface
  • +
  • odbc: Haskell binding to the ODBC API, aimed at SQL Server driver
  • +
  • optparse-applicative: Command line options parsing
  • +
  • ormolu: A formatter for Haskell source code
  • +
  • parallel: A library for parallel programming
  • +
  • pretty: Haskell Pretty-printer library
  • +
  • primitive: Primitive memory-related operations
  • +
  • quickcheck: Framework for running and organising tests, with HUnit and QuickCheck support
  • +
  • random: Pseudo-random number generation
  • +
  • req: Easy-to-use, type-safe, expandable, high-level HTTP client library
  • +
  • rio: A standard library for Haskell
  • +
  • safe-exceptions: safe-exceptions: Safe, consistent, and easy exception handling
  • +
  • serialise: Binary serialisation in the CBOR format
  • +
  • servant-server: A family of combinators for defining webservices APIs and serving them
  • +
  • servant: A family of combinators for defining webservices APIs
  • +
  • snap-server: Snap Framework HTTP Server Library
  • +
  • socket: POSIX sockets API
  • +
  • stm: Software Transactional Memory
  • +
  • tar: Reading, writing and manipulating “.tar” archive files
  • +
  • time-manager: Scalable timer
  • +
  • time: A Time, clocks and calendars library
  • +
  • tls-session-manager: In-memory TLS session manager
  • +
  • tls: Native Haskell TLS and SSL protocol implementation for server and client
  • +
  • transformers: Monad transformers
  • +
  • typed-process: Run external processes, with strong typing of streams
  • +
  • unliftio: Lifting and unlifting IO actions
  • +
  • uuid: For creating, comparing, parsing and printing Universally Unique Identifiers
  • +
  • vector: Efficient Arrays
  • +
  • wai-extra: Provides some basic WAI handlers and middleware.
  • +
  • wai: Web Application Interface
  • +
  • warp-quic: WAI handler for HTTP/3 based on QUIC
  • +
  • weigh: Memory benchmarking
  • +
  • wrap: A fast, light-weight web server for WAI applications
  • +
  • wreq: An easy-to-use HTTP client library
  • +
  • xhtml: XHTML combinator library
  • +
  • yaml: Parsing and rendering YAML
  • +
  • zlib: Compression and decompression in the gzip and zlib formats
  • +
  • zstd: Haskell bindings to the Zstandard compression algorithm]
  • +
+

Tricks to Fight Pain

Static Linking

Alpine Linux use musl libc, it can generate statically-linked programs correctly, see ghc-musl for more details. GNU C Library (glibc) based distributions have this blocker issue Wrong order of -lc and -lpthread when building a static binary.

+

ghc-pkg and cabal does not list user installed packages

After you install packages by cabal, you can not found them by cabal list --installed, this issue had reported to upstream. Here is the workaround.

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# ~/.ghc/x86_64-linux-8.10.4/environments/default
# ~/.cabal/store/ghc-8.10.4/package.db/package.cache

# use the specified package database
$ ghc-pkg list -f ~/.cabal/store/ghc-8.10.4/package.db

# fix the default package database
rm -fr ~/.ghc/x86_64-linux-8.10.4/environments/default
ln -s ~/.cabal/store/ghc-8.10.4/package.db ~/.ghc/x86_64-linux-8.10.4/package.conf.d

# Now it works !

$ cabal list --installed | grep '^\*'| sort -u | wc -l
259

$ ghc-pkg list | awk '{print $1}' | grep -E '^[a-zA-Z]+' | sort -u | wc -l
259

ghc-pkg field cql-io depends
ghc-pkg dot | tred | dot -Tpdf > pkgs.pdf
stack dot | dot -Tpng -o wreq.png
+ +

GHC on Alpine Linux

Prepare Alpine Linux

Both Docker or chroot are good for us.

+

Prepare by Docker

1
docker run --rm -it --pull always -w /root alpine:3
+ +

Prepare by Chroot

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

export LFS=~/x86_64-alpine-linux
rm -fr ${LFS} && mkdir -p ${LFS} && \
cd ${LFS} && \
curl -sSL https://dl-cdn.alpinelinux.org/alpine/v3.13/releases/x86_64/alpine-minirootfs-3.13.2-x86_64.tar.gz \
| tar -xz

cp /etc/resolv.conf $LFS/etc

mknod -m 600 $LFS/dev/console c 5 1
mknod -m 666 $LFS/dev/null c 1 3

mount -v --bind /dev $LFS/dev
mount -v --bind /dev/pts $LFS/dev/pts
mount -vt proc proc $LFS/proc
mount -vt sysfs sysfs $LFS/sys
mount -vt tmpfs tmpfs $LFS/run

cd $LFS/root && chroot "$LFS" /usr/bin/env -i \
HOME=/root \
TERM="$TERM" \
PS1='\u:\w\$ ' \
PATH=/opt/ghc-8.10/bin:/bin:/usr/bin:/sbin:/usr/sbin \
/bin/sh --login
+ +

Install Haskell

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
export PS1="\[\e[31m\][\[\e[m\]\[\e[38;5;172m\]\u\[\e[m\]@\[\e[38;5;153m\]\h\[\e[m\] \[\e[38;5;214m\]\W\[\e[m\]\[\e[31m\]]\[\e[m\]\\$ "
export PATH=/opt/ghc-8.10/bin:/bin:/usr/bin:/sbin:/usr/sbin

cd /root/
apk update && apk upgrade && \
apk add abuild autoconf automake binutils-gold build-base clang cmake coreutils \
curl doxygen file g++ git gnupg grep lld llvm make python3 samurai sudo tar \
vim wget xz \
curl-dev curl-static expat-dev expat-static gmp-dev json-c-dev jsoncpp-dev \
jsoncpp-static libdwarf-dev libdwarf-static libffi-dev librdkafka-dev \
librdkafka-static libunwind-dev libunwind-static libxml2-dev mariadb-dev \
mariadb-static musl-dev ncurses-dev ncurses-static numactl-dev openssl-dev \
openssl-libs-static pcre-dev pcre2-dev postgresql-dev xz-dev yaml-dev \
yaml-static zlib-dev zlib-static zstd-dev zstd-static

apk info -L musl-dev | sort

wget -q -O - https://downloads.haskell.org/~cabal/cabal-install-latest/cabal-install-3.4.0.0-x86_64-alpine-3.11.6-static-noofd.tar.xz \
| tar -xvJ
mv cabal /usr/bin

wget -q -O - https://github.com/commercialhaskell/stack/releases/download/v2.5.1/stack-2.5.1-linux-x86_64.tar.gz \
| tar -xz
mv stack-2.5.1-linux-x86_64/stack /usr/bin
rm -fr stack-2.5.1-linux-x86_64

wget -q -O - https://downloads.haskell.org/~ghc/8.10.4/ghc-8.10.4-x86_64-alpine3.10-linux-integer-simple.tar.xz \
| tar -xJ

cd ghc-8.10.4-x86_64-unknown-linux/
./configure --prefix=/opt/ghc-8.10
make install && cd .. && rm -fr ghc-8.10.4-x86_64-unknown-linux/

# export PATH=/opt/ghc-9.0/bin:/bin:/usr/bin:/sbin:/usr/sbin
#
# wget -q -O - https://downloads.haskell.org/~ghc/9.0.1/ghc-9.0.1-x86_64-alpine3.10-linux-integer-simple.tar.xz \
# | tar -xJ

# cd ghc-9.0.1-x86_64-unknown-linux/
# ./configure --prefix=/opt/ghc-9.0
# make install && cd .. && rm -fr ghc-9.0.1-x86_64-unknown-linux/
+ +

Using Haskell

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
$ ghc --version
$ ghc --show-options
$ ghc --info

$ cat << EOF > HelloWorld.hs
module Main where
main = putStrLn "Hello, World!"
EOF

$ rm -f HelloWorld HelloWorld.hi HelloWorld.o && \
ghc HelloWorld.hs -O2 -optl-s

$ ./HelloWorld
Hello, World !

$ du -ks HelloWorld
5060 HelloWorld

$ file HelloWorld
HelloWorld: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked,
interpreter /lib/ld-musl-x86_64.so.1, stripped

$ ldd HelloWorld
/lib/ld-musl-x86_64.so.1 (0x7f9320ec0000)
libgmp.so.10 => /usr/lib/libgmp.so.10 (0x7f9320e5a000)
libc.musl-x86_64.so.1 => /lib/ld-musl-x86_64.so.1 (0x7f9320ec0000)

$ rm -f HelloWorld HelloWorld.hi HelloWorld.o && \
ghc HelloWorld.hs -O2 -optl-s -optc-static -optl-static

$ ./HelloWorld
Hello, World !

$ du -ks HelloWorld
5472 HelloWorld

$ file HelloWorld
HelloWorld: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, stripped

$ du -ms / /opt/ghc-8.10 /opt/ghc-8.10/*
1488 /
1249 /opt/ghc-8.10
1 /opt/ghc-8.10/bin
1 /opt/ghc-8.10/include
1248 /opt/ghc-8.10/lib
1 /opt/ghc-8.10/mingw
1 /opt/ghc-8.10/share

$ du -ms / /opt/ghc-9.0 /opt/ghc-9.0/*
1972 .
1733 /opt/ghc-9.0
1 /opt/ghc-9.0/bin
1 /opt/ghc-9.0/include
1224 /opt/ghc-9.0/lib
509 /opt/ghc-9.0/share
+ +

Cleanup Alpine Linux

This just need for the chroot setup.

+
1
2
3
4
5
umount --recursive $LFS/run
umount --recursive $LFS/sys
umount --recursive $LFS/proc
umount --recursive $LFS/dev/pts
umount --recursive $LFS/dev
+ +

GHC on SUSE Linux 15

Install Haskell

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
export PS1="\[\e[31m\][\[\e[m\]\[\e[38;5;172m\]\u\[\e[m\]@\[\e[38;5;153m\]\h\[\e[m\] \[\e[38;5;214m\]\W\[\e[m\]\[\e[31m\]]\[\e[m\]\\$ "
export PATH=/opt/ghc-8.10/bin:/bin:/usr/bin:/sbin:/usr/sbin

cd /root/

curl -sSLO http://ftp.debian.org/debian/pool/main/n/ncurses/libtinfo5_6.1+20181013-2+deb10u2_amd64.deb
ar libtinfo5_6.1+20181013-2+deb10u2_amd64.deb
cp -af lib/x86_64-linux-gnu/libtinfo.so.5* /lib64/

zypper install -y glibc-devel gmp-devel libopenssl-devel libcurl-devel \
zlib-devel libzstd-devel xz-devel ncurses-devel pcre-devel pcre2-devel

curl -sSL https://downloads.haskell.org/~cabal/cabal-install-3.4.0.0/cabal-install-3.4.0.0-x86_64-alpine-3.11.6-static-noofd.tar.xz \
| tar -xJ
mv cabal /usr/bin

curl -sSL https://github.com/commercialhaskell/stack/releases/download/v2.5.1/stack-2.5.1-linux-x86_64.tar.gz \
| tar -xz
mv stack-2.5.1-linux-x86_64/stack /usr/bin
rm -fr stack-2.5.1-linux-x86_64

curl -sSL https://downloads.haskell.org/~ghc/8.10.4/ghc-8.10.4-x86_64-deb9-linux.tar.xz \
| tar -xJ

cd ghc-8.10.4/
CC=gcc-10 ./configure --prefix=/opt/ghc-8.10
make install && cd .. && rm -fr ghc-8.10.4/

# export PATH=/opt/ghc-9.0/bin:/bin:/usr/bin:/sbin:/usr/sbin
#
# curl -sSL https://downloads.haskell.org/~ghc/9.0.1/ghc-9.0.1-x86_64-deb9-linux.tar.xz \
# | tar -xJ

# cd ghc-9.0.1/
# CC=gcc-10 ./configure --prefix=/opt/ghc-9.0
# make install && cd .. && rm -fr ghc-9.0.1/
+ +

Using Haskell

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
$ ghc --version
$ ghc --show-options
$ ghc --info

$ cat << EOF > HelloWorld.hs
module Main where
main = putStrLn "Hello, World!"
EOF

$ rm -f HelloWorld HelloWorld.hi HelloWorld.o && \
ghc HelloWorld.hs -O2 -optl-s

$ ./HelloWorld
Hello, World !

$ du -ks HelloWorld
732 HelloWorld [ghc 8.10.4]
744 HelloWorld [ghc 9.0.1]

$ file HelloWorld
HelloWorld: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked,
interpreter /lib64/ld-linux-x86-64.so.2,
BuildID[sha1]=9f1540564ef645a459ee1e01dfd6e9b207c979c5, for GNU/Linux 3.2.0, stripped

$ ldd HelloWorld
linux-vdso.so.1 (0x00007ffff93f9000)
libgmp.so.10 => /usr/lib64/libgmp.so.10 (0x00007f69d66c0000)
libc.so.6 => /lib64/libc.so.6 (0x00007f69d6305000)
libm.so.6 => /lib64/libm.so.6 (0x00007f69d5fcd000)
librt.so.1 => /lib64/librt.so.1 (0x00007f69d5dc5000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f69d5bc1000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f69d59a2000)
/lib64/ld-linux-x86-64.so.2 (0x00007f69d6956000)

# /usr/bin/ld.bfd: error: multiple definition of `__lll_lock_wait_private'
$ rm -f HelloWorld HelloWorld.hi HelloWorld.o && \
ghc HelloWorld.hs -O2 -optl -s -optl -static \
-optl -Wl,--allow-multiple-definition

$ du -ms /opt/ghc-8.10 /opt/ghc-8.10/*
2081 /opt/ghc-8.10
1 /opt/ghc-8.10/bin
1795 /opt/ghc-8.10/lib
287 /opt/ghc-8.10/share

$ du -ms /opt/ghc-9.0 /opt/ghc-9.0/*
2077 /opt/ghc-9.0
1 /opt/ghc-9.0/bin
1776 /opt/ghc-9.0/lib
302 /opt/ghc-9.0/share
+ +

GHC on RHEL 8

Install Haskell

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
export PS1="\[\e[31m\][\[\e[m\]\[\e[38;5;172m\]\u\[\e[m\]@\[\e[38;5;153m\]\h\[\e[m\] \[\e[38;5;214m\]\W\[\e[m\]\[\e[31m\]]\[\e[m\]\\$ "
export PATH=/opt/ghc-8.10/bin:/bin:/usr/bin:/sbin:/usr/sbin

cd /root/

sudo dnf install -y glibc-devel gmp-devel openssl-devel curl-devel \
zlib-devel libzstd-devel xz-devel ncurses-devel pcre-devel pcre2-devel

curl -sSL https://downloads.haskell.org/~cabal/cabal-install-3.4.0.0/cabal-install-3.4.0.0-x86_64-alpine-3.11.6-static-noofd.tar.xz \
| tar -xJ
mv cabal /usr/bin

curl -sSL https://github.com/commercialhaskell/stack/releases/download/v2.5.1/stack-2.5.1-linux-x86_64.tar.gz \
| tar -xz
mv stack-2.5.1-linux-x86_64/stack /usr/bin
rm -fr stack-2.5.1-linux-x86_64

curl -sSL https://downloads.haskell.org/~ghc/8.10.4/ghc-8.10.4-x86_64-deb10-linux.tar.xz \
| tar -xJ

cd ghc-8.10.4/
./configure --prefix=/opt/ghc-8.10
make install && cd .. && rm -fr ghc-8.10.4/

# export PATH=/opt/ghc-9.0/bin:/bin:/usr/bin:/sbin:/usr/sbin
#
# curl -sSL https://downloads.haskell.org/~ghc/9.0.1/ghc-9.0.1-x86_64-deb10-linux.tar.xz \
# | tar -xJ

# cd ghc-9.0.1/
# ./configure --prefix=/opt/ghc-9.0
# make install && cd .. && rm -fr ghc-9.0.1/
+ +

Using Haskell

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
$ ghc --version
$ ghc --show-options
$ ghc --info

$ cat << EOF > HelloWorld.hs
module Main where
main = putStrLn "Hello, World!"
EOF

$ rm -f HelloWorld HelloWorld.hi HelloWorld.o && \
ghc HelloWorld.hs -O2 -optl-s

$ ./HelloWorld
Hello, World !

$ du -ks HelloWorld
752 HelloWorld [ghc 8.10.4]
764 HelloWorld [ghc 9.0.1]

$ file HelloWorld
HelloWorld: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked,
interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0,
BuildID[sha1]=4f23f2d113a7e64e9933897e0d1f21277b84496b, stripped

$ ldd HelloWorld
linux-vdso.so.1 (0x00007ffc949f2000)
libgmp.so.10 => /lib64/libgmp.so.10 (0x00007f2a4d368000)
libc.so.6 => /lib64/libc.so.6 (0x00007f2a4cfa5000)
libm.so.6 => /lib64/libm.so.6 (0x00007f2a4cc23000)
librt.so.1 => /lib64/librt.so.1 (0x00007f2a4ca1b000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f2a4c817000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f2a4c5f7000)
/lib64/ld-linux-x86-64.so.2 (0x00007f2a4d600000)

# # /usr/bin/ld.bfd: error: multiple definition of `__lll_lock_wait_private'
$ rm -f HelloWorld HelloWorld.hi HelloWorld.o && \
ghc HelloWorld.hs -O2 -optl -s -optl -static \
-optl -Wl,--allow-multiple-definition

$ du -ms /opt/ghc-8.10 /opt/ghc-8.10/*
2091 /opt/ghc-8.10
1 /opt/ghc-8.10/bin
1805 /opt/ghc-8.10/lib
287 /opt/ghc-8.10/share

$ du -ms /opt/ghc-9.0 /opt/ghc-9.0/*
2103 /opt/ghc-9.0
1 /opt/ghc-9.0/bin
1801 /opt/ghc-9.0/lib
303 /opt/ghc-9.0/share
+ +

Program Structure

Every complete Haskell program must define main in module Main in package main.

+
    +
  1. At the topmost level a Haskell program is a set of modules. Modules provide a way to control namespaces and to re-use software in large programs.

    +
  2. +
  3. The top level of a module consists of a collection of declarations, of which there are several kinds. Declarations define things such as ordinary values, datatypes, type classes, and fixity information.

    +
  4. +
  5. At the next lower level are expressions. An expression denotes a value and has a static type; expressions are at the heart of Haskell programming “in the small.”

    +
  6. +
  7. At the bottom level is Haskell’s lexical structure. The lexical structure captures the concrete representation of Haskell programs in text files.

    +
  8. +
+

Language extensions

50% of all production Haskell code is language extension and import lines

+
1
2
3
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE GADTs #-}
+ +

Added at the top of your file. Basic structure:

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/env stack
-- stack --resolver lts-16.31 script

{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE LambdaCase #-}

module Main (main) where

import Control.Monad (when)
-- import ...

main :: IO ()
main = putStrLn "Finally, some actual code!"
+ +

Modules

A module defines a collection of values, datatypes, type synonyms, classes, etc., in an environment created by a set of imports (resources brought into scope from other modules). It exports some of these resources, making them available to other modules. We use the term entity to refer to a value, type, or class defined in, imported into, or perhaps exported from a module.

+

A Haskell program is a collection of modules, one of which, by convention, must be called Main and must export the value main. The value of the program is the value of the identifier main in module Main, which must be a computation of type IO τ for some type τ. When the program is executed, the computation main is performed, and its result (of type τ) is discarded.

+

Module Structure

A module defines a mutually recursive scope containing declarations for value bindings, data types, type synonyms, classes, etc.

+
1
2
3
4
5
6
7
8
module  →  module modid [exports] where body
| body
body → { impdecls ; topdecls }
| { impdecls }
| { topdecls }

impdecls → impdecl1 ; … ; impdecln (n ≥ 1)
topdecls → topdecl1 ; … ; topdecln (n ≥ 1)
+ +

A module begins with a header: the keyword module, the module name, and a list of entities (enclosed in round parentheses) to be exported. The header is followed by a possibly-empty list of import declarations that specify modules to be imported, optionally restricting the imported bindings. This is followed by a possibly-empty list of top-level declarations.

+

An abbreviated form of module, consisting only of the module body, is permitted. If this is used, the header is assumed to be ‘module Main(main) where’. If the first lexeme in the abbreviated module is not a {, then the layout rule applies for the top level of the module.

+

Export Lists

1
2
3
4
5
6
7
8
exports  →  ( export1 , … , exportn [ , ] )      (n ≥ 0)

export → qvar
| qtycon [(..) | ( cname1 , … , cnamen )] (n ≥ 0)
| qtycls [(..) | ( var1 , … , varn )] (n ≥ 0)
| module modid

cname → var | con
+ +

An export list identifies the entities to be exported by a module declaration. A module implementation may only export an entity that it declares, or that it imports from some other module. If the export list is omitted, all values, types and classes defined in the module are exported, but not those that are imported.

+

Import Declarations

1
2
3
4
5
6
7
8
9
impdecl  →  import [qualified] modid [as modid] [impspec]
| (empty declaration)
impspec → ( import1 , … , importn [ , ] ) (n ≥ 0)
| hiding ( import1 , … , importn [ , ] ) (n ≥ 0)

import → var
| tycon [ (..) | ( cname1 , … , cnamen )] (n ≥ 0)
| tycls [(..) | ( var1 , … , varn )] (n ≥ 0)
cname → var | con
+ +

The entities exported by a module may be brought into scope in another module with an import declaration at the beginning of the module. The import declaration names the module to be imported and optionally specifies the entities to be imported. A single module may be imported by more than one import declaration. Imported names serve as top level declarations: they scope over the entire body of the module but may be shadowed by local non-top-level bindings.

+

The effect of multiple import declarations is strictly cumulative: an entity is in scope if it is imported by any of the import declarations in a module. The ordering of import declarations is irrelevant.

+

Lexically, the terminal symbols “as”, “qualified” and “hiding” are each a varid rather than a reservedid. They have special significance only in the context of an import declaration; they may also be used as variables.

+

What is imported

Exactly which entities are to be imported can be specified in one of the following three ways:

+
    +
  1. The imported entities can be specified explicitly by listing them in parentheses. Items in the list have the same form as those in export lists, except qualifiers are not permitted and the ‘module modid’ entity is not permitted. When the (..) form of import is used for a type or class, the (..) refers to all of the constructors, methods, or field names exported from the module.
  2. +
+

The list must name only entities exported by the imported module. The list may be empty, in which case nothing except the instances is imported.

+
    +
  1. Entities can be excluded by using the form hiding(import1 , … , importn ), which specifies that all entities exported by the named module should be imported except for those named in the list. Data constructors may be named directly in hiding lists without being prefixed by the associated type. Thus, in import M hiding (C) any constructor, class, or type named C is excluded. In contrast, using C in an import list names only a class or type.
  2. +
+

It is an error to hide an entity that is not, in fact, exported by the imported module.

+
    +
  1. Finally, if impspec is omitted then all the entities exported by the specified module are imported.
  2. +
+

Lexical Structure

    +
  • Notational Conventions
  • +
  • Lexical Program Structure
  • +
  • Comments
  • +
  • Identifiers and Operators
  • +
  • Numeric Literals
  • +
  • Character and String Literals
  • +
  • Layout
  • +
+

Expressions

    +
  • Errors
  • +
  • Variables, Constructors, Operators, and Literals
  • +
  • Curried Applications and Lambda Abstractions
  • +
  • Operator Applications
  • +
  • Sections
  • +
  • Conditionals
  • +
  • Lists
  • +
  • Tuples
  • +
  • Unit Expressions and Parenthesized Expressions
  • +
  • Arithmetic Sequences
  • +
  • List Comprehensions
  • +
  • Let Expressions
  • +
  • Case Expressions
  • +
  • Do Expressions
  • +
  • Datatypes with Field Labels
  • +
  • Expression Type-Signatures
  • +
  • Pattern Matching
  • +
+

Predefined Types and Classes

    +
  • Standard Haskell Types
  • +
  • Strict Evaluation
  • +
  • Standard Haskell Classes
  • +
  • Numbers
  • +
+

Standard Haskell Types

Booleans

1
2
data  Bool  =  False | True deriving
(Read, Show, Eq, Ord, Enum, Bounded)
+ +

The boolean type Bool is an enumeration. The basic boolean functions are && (and), || (or), and not. The name otherwise is defined as True to make guarded expressions more readable.

+

Characters and Strings

The character type Char is an enumeration whose values represent Unicode characters. Type Char is an instance of the classes Read, Show, Eq, Ord, Enum, and Bounded. The toEnum and fromEnum functions, standard functions from class Enum, map characters to and from the Int type.

+

A string is a list of characters:

+
1
type  String  =  [Char]
+ +

Lists

1
data  [a]  =  [] | a : [a]  deriving (Eq, Ord)
+ +

Lists are an algebraic datatype of two constructors, although with special syntax. Lists are an instance of classes Read, Show, Eq, Ord, Monad, Functor, and MonadPlus.

+

Tuples

Tuples are algebraic datatypes with special syntax. Each tuple type has a single constructor. All tuples are instances of Eq, Ord, Bounded, Read, and Show (provided, of course, that all their component types are).

+

Haskell implementation must support tuples up to size 15, together with the instances for Eq, Ord, Bounded, Read, and Show. The Prelude and libraries define tuple functions such as zip for tuples up to a size of 7.

+

The Unit Datatype

1
data  () = () deriving (Eq, Ord, Bounded, Enum, Read, Show)
+ +

The unit datatype () has one non-⊥ member, the nullary constructor ().

+

Function Types

Functions are an abstract type: no constructors directly create functional values. The following simple functions are found in the Prelude: id, const, (.), flip, ($), and until.

+

The IO and IOError Types

The IO type serves as a tag for operations (actions) that interact with the outside world. The IO type is abstract: no constructors are visible to the user. IO is an instance of the Monad and Functor classes.

+

IOError is an abstract type representing errors raised by I/O operations. It is an instance of Show and Eq.

+

Other Types

1
2
3
4
data  Maybe a     =  Nothing | Just a  deriving (Eq, Ord, Read, Show)
data Either a b = Left a | Right b deriving (Eq, Ord, Read, Show)
data Ordering = LT | EQ | GT deriving
(Eq, Ord, Bounded, Enum, Read, Show)
+ +

The Maybe type is an instance of classes Functor, Monad, and MonadPlus. The Ordering type is used by compare in the class Ord. The functions maybe and either are found in the Prelude.

+

Standard Haskell Classes

    +
  • Eq
  • +
  • Ord
  • +
  • Read and Show
  • +
  • Enum
  • +
  • Functor
  • +
  • Monad
  • +
  • Bounded
  • +
  • Numbers
      +
    • Integer (Integral)
    • +
    • Int [−2^29, 2^29−1] (Integral)
    • +
    • Float (RealFloat)
    • +
    • Double (RealFloat)
    • +
    • The class Integral contains integers of both limited and unlimited range; the class Fractional contains all non-integral types; and the class Floating contains all floating-point types, both real and complex.
    • +
    +
  • +
+

Basic Input/Output

Standard I/O Functions

Output Functions

These functions write to the standard output device (this is normally the user’s terminal).

+
1
2
3
4
5

putChar :: Char -> IO ()
putStr :: String -> IO ()
putStrLn :: String -> IO () -- adds a newline
print :: Show a => a -> IO ()
+ +

Input Functions

These functions read input from the standard input device (normally the user’s terminal).

+
1
2
3
4
5
6
getChar     :: IO Char
getLine :: IO String
getContents :: IO String
interact :: (String -> String) -> IO ()
readIO :: Read a => String -> IO a
readLn :: Read a => IO a
+ +

Files

These functions operate on files of characters. Files are named by strings using some implementation-specific method to resolve strings as file names.

+

The writeFile and appendFile functions write or append the string, their second argument, to the file, their first argument. The readFile function reads a file and returns the contents of the file as a string. The file is read lazily, on demand, as with getContents.

+
1
2
3
4
5
type FilePath =  String

writeFile :: FilePath -> String -> IO ()
appendFile :: FilePath -> String -> IO ()
readFile :: FilePath -> IO String
+ +

Sequencing I/O Operations

The type constructor IO is an instance of the Monad class. The two monadic binding functions, methods in the Monad class, are used to compose a series of I/O operations. The >> function is used where the result of the first operation is uninteresting, for example when it is (). The >>= operation passes the result of the first operation as an argument to the second operation.

+
1
2
(>>=) :: IO a -> (a -> IO b) -> IO b
(>>) :: IO a -> IO b -> IO b
+ +

Exception Handling in the I/O Monad

The I/O monad includes a simple exception handling system. Any I/O operation may raise an exception instead of returning a result.

+

Exceptions in the I/O monad are represented by values of type IOError. This is an abstract type: its constructors are hidden from the user. The IO library defines functions that construct and examine IOError values. The only Prelude function that creates an IOError value is userError. User error values include a string describing the error.

+
1
userError :: String -> IOError
+ +

Exceptions are raised and caught using the following functions:

+
1
2
ioError :: IOError -> IO a
catch :: IO a -> (IOError -> IO a) -> IO a
+ +

Foreign Function Interface

    +
  • Foreign Languages
  • +
  • Contexts
  • +
  • Lexical Structure
  • +
  • Foreign Declarations
      +
    • Calling Conventions
    • +
    • Foreign Types
        +
      • Char, Int, Double, Float, and Bool as exported by the Haskell Prelude as well as
      • +
      • Int8, Int16, Int32, Int64, Word8, Word16, Word32, Word64, Ptr a, FunPtr a, and StablePtr a, for any type a, as exported by Foreign
      • +
      +
    • +
    • Import Declarations
    • +
    • Export Declarations
    • +
    +
  • +
  • Specification of External Entities
      +
    • Standard C Calls
    • +
    • Win32 API Calls
    • +
    +
  • +
  • Marshalling
  • +
  • The External C Interface
  • +
+

Compiler Pragmas

    +
  • Inlining
  • +
  • Specialization
  • +
  • Language extensions
  • +
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2021/03/14/cross-compiling-rust-for-windows-msvc-target/index.html b/2021/03/14/cross-compiling-rust-for-windows-msvc-target/index.html new file mode 100644 index 00000000..983b7ce4 --- /dev/null +++ b/2021/03/14/cross-compiling-rust-for-windows-msvc-target/index.html @@ -0,0 +1,253 @@ + + + + + + + + + + + + Cross compiling Rust for Windows MSVC target | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Cross compiling Rust for Windows MSVC target +

+ +

Cross compiling Rust for Windows MSVC target

Generally, We can compiling Rust applications for the Windows target x86_64-pc-windows-gnu. But for the Windows target x86_64-pc-windows-msvc, we need Wine or on the Windows host. Now, we can use lld to create the Windows target x86_64-pc-windows-gnu.

+

Copy MSVC libraries to the Linux host

The target directory

1
2
3
4
5
# x86_64-unknown-linux-gnu -> x86_64-pc-windows-msvc
export RUST_MSVC_LIB_PATH=${RUSTUP_HOME:-~/.rustup}/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-msvc/lib

# x86_64-unknown-linux-musl -> x86_64-pc-windows-msvc
export RUST_MSVC_LIB_PATH=${RUSTUP_HOME:-~/.rustup}/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-pc-windows-msvc/lib
+ +

Copy VC runtime libraries

+
1
2
3
4
5
6
7
8
9
10
11
# You need adjust the source directory if needed.
cd "/mnt/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/lib/x64"
cd "/mnt/c/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.29.30133/lib/x64"

cp vcruntime.lib ${RUST_MSVC_LIB_PATH}/vcruntime.lib
cp msvcrt.lib ${RUST_MSVC_LIB_PATH}/msvcrt.lib
cp msvcprt.lib ${RUST_MSVC_LIB_PATH}/msvcprt.lib
cp iso_stdio_wide_specifiers.lib ${RUST_MSVC_LIB_PATH}/iso_stdio_wide_specifiers.lib
cp libvcruntime.lib ${RUST_MSVC_LIB_PATH}/libvcruntime.lib
cp libcmt.lib ${RUST_MSVC_LIB_PATH}/libcmt.lib
cp libcpmt.lib ${RUST_MSVC_LIB_PATH}/libcpmt.lib
+ +

Copy UCRT libraries

+
1
2
3
4
5
# You need adjust the source directory if needed.
cd "/mnt/c/Program Files (x86)/Windows Kits/10/Lib/10.0.19041.0/ucrt/x64"

cp ucrt.lib ${RUST_MSVC_LIB_PATH}/ucrt.lib
cp libucrt.lib ${RUST_MSVC_LIB_PATH}/libucrt.lib
+ +

Copy Windows API libraries

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# You need adjust the source directory if needed.
cd "/mnt/c/Program Files (x86)/Windows Kits/10/Lib/10.0.19041.0/um/x64"

cp AdvAPI32.Lib ${RUST_MSVC_LIB_PATH}/advapi32.lib
cp bcrypt.lib ${RUST_MSVC_LIB_PATH}/bcrypt.lib
cp Crypt32.Lib ${RUST_MSVC_LIB_PATH}/crypt32.lib
cp kernel32.Lib ${RUST_MSVC_LIB_PATH}/kernel32.lib
cp MsWSock.Lib ${RUST_MSVC_LIB_PATH}/mswsock.lib
cp odbc32.lib ${RUST_MSVC_LIB_PATH}/odbc32.lib
cp OneCore_apiset.Lib ${RUST_MSVC_LIB_PATH}/onecore_apiset.lib
cp OneCore.Lib ${RUST_MSVC_LIB_PATH}/onecore.lib
cp Psapi.Lib ${RUST_MSVC_LIB_PATH}/psapi.lib
cp User32.Lib ${RUST_MSVC_LIB_PATH}/user32.lib
cp UserEnv.Lib ${RUST_MSVC_LIB_PATH}/userenv.lib
cp Uuid.Lib ${RUST_MSVC_LIB_PATH}/uuid.lib
cp WS2_32.Lib ${RUST_MSVC_LIB_PATH}/ws2_32.lib
+ +

Windows umbrella libraries

+ + + + + + + + + + + + + + + + + + + + + + + +
LibraryScenario
OneCore.libAll editions of Windows 7 and later, no UWP support
OneCore_apiset.libThis library provides the same coverage as OneCore.lib, but uses API set direct forwarding. Note that using this library will be compatible only with the Windows 10 version as specified by the SDK verion you’re targeting, or greater.
OneCoreUAP.libWindows 7 and later, UWP editions (Desktop, IoT, HoloLens, but not Nano Server) of Windows 10
OneCoreUAP_apiset.libThis library provides the same coverage as OneCoreUAP.lib, but uses the API set direct forwarding technique. Note that using this library will be compatible only with the Windows 10 version as specified by the SDK you’re targeting, or greater.
+

How we known which libraries need to be copy

During the link time, rust will report which libraries not found, just find them on Windows, and copy them to Linux.

+

Rust linked libraries

+
1
2
3
#[link(name = "advapi32")]
#[link(name = "ws2_32")]
#[link(name = "userenv")]
+ +

LLVM linked libraries

+
1
2
3
4
5
6
target_link_libraries(${target} PRIVATE ucrt${LIB_SUFFIX}) # Universal C runtime
target_link_libraries(${target} PRIVATE vcruntime${LIB_SUFFIX}) # C++ runtime
target_link_libraries(${target} PRIVATE msvcrt${LIB_SUFFIX}) # C runtime startup files
target_link_libraries(${target} PRIVATE msvcprt${LIB_SUFFIX}) # C++ standard library. Required for exception_ptr internals.
# Required for standards-complaint wide character formatting functions (e.g. `printfw`/`scanfw`)
target_link_libraries(${target} PRIVATE iso_stdio_wide_specifiers)
+ +

Let’s have a test

Hello World

1
2
3
4
5
$ cat << EOF > hello-world.rs
fn main() {
println!("Hello, world!");
}
EOF
+ +

Use DLL C runtime library

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
$ rustc -C opt-level=3 -C link-arg="-s" \
--target=x86_64-pc-windows-msvc -C linker=lld-link -o hello-world-windows-x86_64.exe \
hello-world.rs

$ du -ks hello-world-windows-x86_64.exe
152 hello-world-windows-x86_64.exe

$ file hello-world-windows-x86_64.exe
hello-world-windows-x86_64.exe: PE32+ executable (console) x86-64, for MS Windows

$ /usr/bin/x86_64-w64-mingw32-objdump -x hello-world-windows-x86_64.exe | grep -E '^\s*DLL Name'
DLL Name: KERNEL32.dll
DLL Name: VCRUNTIME140.dll
DLL Name: api-ms-win-crt-runtime-l1-1-0.dll
DLL Name: api-ms-win-crt-stdio-l1-1-0.dll
DLL Name: api-ms-win-crt-math-l1-1-0.dll
DLL Name: api-ms-win-crt-locale-l1-1-0.dll
DLL Name: api-ms-win-crt-heap-l1-1-0.dll
+ +
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
PS C:\> dumpbin /NOLOGO /DEPENDENTS hello-world-windows-x86_64.exe

Dump of file hello-world-windows-x86_64.exe

File Type: EXECUTABLE IMAGE

Image has the following dependencies:

KERNEL32.dll
VCRUNTIME140.dll
api-ms-win-crt-runtime-l1-1-0.dll
api-ms-win-crt-stdio-l1-1-0.dll
api-ms-win-crt-math-l1-1-0.dll
api-ms-win-crt-locale-l1-1-0.dll
api-ms-win-crt-heap-l1-1-0.dll

Summary

1000 .00cfg
1000 .data
1000 .gehcont
2000 .pdata
8000 .rdata
1000 .reloc
1C000 .text
1000 .tls
+ +

Use static C runtime library

1
2
3
4
5
6
7
8
9
10
11
12
$ rustc -C opt-level=3 -C link-arg="-s" -C "target-feature=+crt-static" \
--target=x86_64-pc-windows-msvc -C linker=lld-link -o hello-world-windows-x86_64.exe \
hello-world.rs

$ du -ks hello-world-windows-x86_64.exe
244 hello-world-windows-x86_64.exe

$ file hello-world-windows-x86_64.exe
hello-world-windows-x86_64.exe: PE32+ executable (console) x86-64, for MS Windows

$ /usr/bin/x86_64-w64-mingw32-objdump -x hello-world-windows-x86_64.exe | grep -E '^\s*DLL Name'
DLL Name: KERNEL32.dll
+ +
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
PS C:\> dumpbin /NOLOGO /DEPENDENTS hello-world-windows-x86_64.exe

Dump of file hello-world-windows-x86_64.exe

File Type: EXECUTABLE IMAGE

Image has the following dependencies:

KERNEL32.dll

Summary

1000 .00cfg
2000 .data
1000 .gehcont
3000 .pdata
10000 .rdata
1000 .reloc
29000 .text
1000 .tls
1000 _RDATA
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2021/03/20/cross-compiling-rust-and-running-with-qemu-or-wine/index.html b/2021/03/20/cross-compiling-rust-and-running-with-qemu-or-wine/index.html new file mode 100644 index 00000000..0b6117c8 --- /dev/null +++ b/2021/03/20/cross-compiling-rust-and-running-with-qemu-or-wine/index.html @@ -0,0 +1,226 @@ + + + + + + + + + + + + Cross compiling Rust and Running with QEMU or Wine | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Cross compiling Rust and Running with QEMU or Wine +

+ +

Cross compiling Rust and Running with QEMU or Wine

Setup Linux

1
2
3
4
5
6
7
8
9
10
11
12
13
sudo apt-get update && \
sudo apt-get dist-upgrade -y && \
sudo apt-get install -y --no-install-recommends \
binutils-aarch64-linux-gnu \
binutils-arm-linux-gnueabihf \
binutils-mips64-linux-gnuabi64 \
binutils-riscv64-linux-gnu \
binutils-s390x-linux-gnu \
binutils-x86-64-linux-gnu \
lld-11 \
musl-tools \
qemu-user-static \
wine64
+ +

Setup Rust

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

rustup self update

rustup update

rustup target add \
aarch64-unknown-linux-musl \
arm-unknown-linux-musleabihf \
armv7-unknown-linux-musleabihf \
mips64-unknown-linux-muslabi64 \
riscv64gc-unknown-linux-gnu \
s390x-unknown-linux-gnu \
wasm32-wasi \
x86_64-pc-windows-msvc \
x86_64-unknown-linux-musl
+ +

Setup WebAssembly interpreter

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
curl -sSL https://github.com/wasmerio/wasmer/releases/download/1.0.2/wasmer-linux-amd64.tar.gz \
| sudo tar -xvz --strip-components=1 -C /usr/bin --wildcards */wasmer

sudo curl -sSL -o /usr/bin/wasm3 https://github.com/wasm3/wasm3/releases/download/v0.4.9/wasm3-cosmopolitan.com
sudo chmod +x /usr/bin/wasm3

curl -sSL https://github.com/bytecodealliance/wasmtime/releases/download/v0.25.0/wasmtime-v0.25.0-x86_64-linux.tar.xz \
| sudo tar -xvJ --strip-components=1 -C /usr/bin --wildcards */wasmtime

$ wasmer --version
wasmer-headless 1.0.2

$ wasm3 --version
Wasm3 v0.4.9 on x86_64
Build: Mar 12 2021 00:17:49, GCC 9.3.0

$ wasmtime --version
wasmtime 0.25.0
+ +

Hello World

1
2
3
4
5
$ cat << EOF > hello-world.rs
fn main() {
println!("Hello, world!");
}
EOF
+ +

Linux arm64

1
2
3
4
5
6
7
8
9
10
11
12
$ rustc -C opt-level=3 -C link-arg="-s" \
--target=aarch64-unknown-linux-musl -C linker=aarch64-linux-gnu-ld -o hello-world-linux-aarch64 \
hello-world.rs

$ du -ks hello-world-linux-aarch64
316 hello-world-linux-aarch64

$ file hello-world-linux-aarch64
hello-world-linux-aarch64: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, stripped

$ qemu-aarch64-static hello-world-linux-aarch64
Hello, world!
+ +

Linux armhf

1
2
3
4
5
6
7
8
9
10
11
12
$ rustc -C opt-level=3 -C link-arg="-s" \
--target=arm-unknown-linux-musleabihf -C linker=arm-linux-gnueabihf-ld -o hello-world-linux-armhf \
hello-world.rs

$ du -ks hello-world-linux-armhf
304 hello-world-linux-armhf

$ file hello-world-linux-armhf
hello-world-linux-armhf: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, stripped

$ qemu-arm-static hello-world-linux-armhf
Hello, world!
+ +

Linux armv7

1
2
3
4
5
6
7
8
9
10
11
12
$ rustc -C opt-level=3 -C link-arg="-s" \
--target=armv7-unknown-linux-musleabihf -C linker=arm-linux-gnueabihf-ld -o hello-world-linux-armv7 \
hello-world.rs

$ du -ks hello-world-linux-armv7
276 hello-world-linux-armv7

$ file hello-world-linux-armv7
hello-world-linux-armv7: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, stripped

$ qemu-arm-static hello-world-linux-armv7
Hello, world!
+ +

Linux mips64

1
2
3
4
5
6
7
8
9
10
11
12
$ rustc -C opt-level=3 -C link-arg="-s" \
--target=mips64-unknown-linux-muslabi64 -C linker=mips64-linux-gnuabi64-ld -o hello-world-linux-mips64 \
hello-world.rs

$ du -ks hello-world-linux-mips64
444 hello-world-linux-mips64

$ file hello-world-linux-mips64
hello-world-linux-mips64: ELF 64-bit MSB executable, MIPS, MIPS64 rel2 version 1 (SYSV), statically linked, stripped

$ qemu-mips64-static hello-world-linux-mips64
Hello, world!
+ +

Linux riscv64

1
2
3
4
5
6
7
8
9
10
11
12
$ rustc -C opt-level=3 -C link-arg="-s" \
--target=riscv64gc-unknown-linux-gnu -C linker=riscv64-linux-gnu-gcc -o hello-world-linux-riscv64 \
hello-world.rs

$ du -ks hello-world-linux-riscv64
248 hello-world-linux-riscv64

$ file hello-world-linux-riscv64
hello-world-linux-riscv64: ELF 64-bit LSB pie executable, UCB RISC-V, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-riscv64-lp64d.so.1, BuildID[sha1]=09f924445a178acccd328d89104760203b98dd43, for GNU/Linux 4.15.0, stripped

$ QEMU_LD_PREFIX=/usr/riscv64-linux-gnu/ qemu-riscv64-static ./hello-world-linux-riscv64
Hello, world!
+ +

Linux s390x

1
2
3
4
5
6
7
8
9
10
11
12
$ rustc -C opt-level=3 -C link-arg="-s" \
--target=s390x-unknown-linux-gnu -C linker=s390x-linux-gnu-gcc -o hello-world-linux-s390x \
hello-world.rs

$ du -ks hello-world-linux-s390x
380 hello-world-linux-s390x

$ file hello-world-linux-s390x
hello-world-linux-s390x: ELF 64-bit MSB pie executable, IBM S/390, version 1 (SYSV), dynamically linked, interpreter /lib/ld64.so.1, BuildID[sha1]=313640a3ef84a9f17cba436152349c02c849a1b2, for GNU/Linux 3.2.0, stripped

$ QEMU_LD_PREFIX=/usr/s390x-linux-gnu/ qemu-s390x-static ./hello-world-linux-s390x
Hello, world!
+ +

Linux x86_64

General

1
2
3
4
5
6
7
8
9
10
11
12
$ rustc -C opt-level=3 -C link-arg="-s"  \
--target=x86_64-unknown-linux-musl -C linker="x86_64-linux-gnu-ld" -o hello-world-linux-amd64 \
hello-world.rs

$ du -ks hello-world-linux-amd64
380 hello-world-linux-amd64

$ file hello-world-linux-amd64
hello-world-linux-amd64: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, stripped

$ qemu-x86_64-static hello-world-linux-amd64
Hello, world!
+ +

ASLR

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
$ cat << EOF > aslr.rs
fn main() {
println!("main = {:#x}", &main as *const _ as usize);
}
EOF

$ rustc -C opt-level=3 -C link-arg="-s" \
--target=x86_64-unknown-linux-musl -C linker="x86_64-linux-gnu-ld" -o aslr-linux-amd64 \
aslr.rs

$ file aslr-linux-amd64
aslr-linux-amd64: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, stripped

$ du -ks aslr-linux-amd64
380 aslr-linux-amd64

$ ./aslr-linux-amd64
main = 0x7ff5cb823008

$ ./aslr-linux-amd64
main = 0x7fd5aa251008
+ +

WebAssembly System Interface

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
$ rustc -C opt-level=3 -C link-arg="-s" --target=wasm32-wasi -o hello-world-wasm32-wasi hello-world.rs

$ du -ks hello-world-wasm32-wasi
76 hello-world-wasm32-wasi

$ file hello-world-wasm32-wasi
hello-world-wasm32-wasi: WebAssembly (wasm) binary module version 0x1 (MVP)

$ wasmer run hello-world-wasm32-wasi
Hello, world!

$ wasm3 hello-world-wasm32-wasi
Hello, world!

$ wasmtime run hello-world-wasm32-wasi
Hello, world!
+ +

Windows x86_64

Use DLL C runtime library

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
$ rustc -C opt-level=3 -C link-arg="-s" \
--target=x86_64-pc-windows-msvc -C linker=lld-link-11 -o hello-world-windows-x86_64.exe \
hello-world.rs

$ du -ks hello-world-windows-x86_64.exe
144 hello-world-windows-x86_64.exe

$ file hello-world-windows-x86_64.exe
hello-world-windows-x86_64.exe: PE32+ executable (console) x86-64, for MS Windows

$ wine64 hello-world-windows-x86_64.exe
Hello, world!

$ /usr/bin/x86_64-w64-mingw32-objdump -x hello-world-windows-x86_64.exe | grep -E '^\s*DLL Name'
DLL Name: KERNEL32.dll
DLL Name: VCRUNTIME140.dll
DLL Name: api-ms-win-crt-runtime-l1-1-0.dll
DLL Name: api-ms-win-crt-stdio-l1-1-0.dll
DLL Name: api-ms-win-crt-math-l1-1-0.dll
DLL Name: api-ms-win-crt-locale-l1-1-0.dll
DLL Name: api-ms-win-crt-heap-l1-1-0.dll
+ +

Use static C runtime library

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$ rustc -C opt-level=3 -C link-arg="-s" -C "target-feature=+crt-static" \
--target=x86_64-pc-windows-msvc -C linker=lld-link-11 -o hello-world-windows-x86_64.exe \
hello-world.rs

$ du -ks hello-world-windows-x86_64.exe
236 hello-world-windows-x86_64.exe

$ file hello-world-windows-x86_64.exe
hello-world-windows-x86_64.exe: PE32+ executable (console) x86-64, for MS Windows

$ wine64 hello-world-windows-x86_64.exe
Hello, world!

$ /usr/bin/x86_64-w64-mingw32-objdump -x hello-world-windows-x86_64.exe | grep -E '^\s*DLL Name'
DLL Name: KERNEL32.dll
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2021/03/21/statically-linked-executable-hardening-with-pie/index.html b/2021/03/21/statically-linked-executable-hardening-with-pie/index.html new file mode 100644 index 00000000..4c49388a --- /dev/null +++ b/2021/03/21/statically-linked-executable-hardening-with-pie/index.html @@ -0,0 +1,297 @@ + + + + + + + + + + + + Statically Linked Executable Hardening with PIE | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Statically Linked Executable Hardening with PIE +

+ +

Statically Linked Executable Hardening with PIE

In a nutshell

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Target tripletsstatic-piepieLinuxglibc
aarch64-linux-gnu-gccOKOKLinux 3.7GLIBC_2.17
arm-linux-gnueabihf-gccrcrt1.oOKLinux 3.2GLIBC_2.4
mips64-linux-gnuabi64-gccrcrt1.oOKLinux 3.2GLIBC_2.2
mipsisa64r6-linux-gnuabi64-gccrcrt1.oOKLinux 4.5GLIBC_2.2
riscv64-linux-gnu-gccrcrt1.oOKLinux 4.15GLIBC_2.27
s390x-linux-gnu-gccrcrt1.oOKLinux 3.2GLIBC_2.2
x86_64-linux-gnu-gccOKOKLinux 3.2GLIBC_2.2.5
+

Hello World

1
2
3
4
5
6
7
8
9
$ cat << EOF > HelloWorld.c
# include <stdio.h>

int main()
{
printf("Hello, World!\n");
return 0;
}
EOF
+ +

Static PIE Generation

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
$ export HARDENING_FLAGS=" -D_FORTIFY_SOURCE=2 -D_GLIBCXX_ASSERTIONS -Wall -Wextra -Wformat=2 -Wdate-time -Werror=format-security -Wstack-protector -fasynchronous-unwind-tables -fexceptions -fstack-protector-strong -fstack-clash-protection -pedantic -z defs -z noexecstack -z now -z relro -z text -fPIE"

$ x86_64-linux-gnu-gcc -O2 -march=haswell -mavx2 -std=c11 ${HARDENING_FLAGS} -pie -s -o HelloWorld HelloWorld.c

$ x86_64-linux-gnu-gcc -O2 -march=haswell -mavx2 -std=c11 ${HARDENING_FLAGS} --static-pie -s -o HelloWorld HelloWorld.c

$ file HelloWorld
HelloWorld: ELF 64-bit LSB pie executable, UCB RISC-V, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-riscv64-lp64d.so.1, BuildID[sha1]=b9f6b891213352dc1595c34538bc6974dd59465d, for GNU/Linux 4.15.0, stripped

$ file HelloWorld
HelloWorld: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=4aa140be9886b18dc6e8cfe969f0c62221dd5ddb, for GNU/Linux 3.2.0, stripped

$ file HelloWorld
HelloWorld: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=ce5c70eefd3813ae25cbb405af8399d689b469ac, for GNU/Linux 3.2.0, stripped


$ readelf -dl HelloWorld | grep -E "Shared library:|program interpreter:"
[Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]
0x0000000000000001 (NEEDED) Shared library: [libc.so.6]

$ objdump -x HelloWorld | grep -C 1 GLIBC

required from libc.so.6:
0x06969187 0x00 02 GLIBC_2.27

$ objdump -j .dynstr -s HelloWorld

HelloWorld: file format elf64-little

Contents of section .dynstr:
0388 00707574 73005f5f 6378615f 66696e61 .puts.__cxa_fina
0398 6c697a65 005f5f6c 6962635f 73746172 lize.__libc_star
03a8 745f6d61 696e006c 6962632e 736f2e36 t_main.libc.so.6
03b8 00474c49 42435f32 2e323700 5f49544d .GLIBC_2.27._ITM
03c8 5f646572 65676973 74657254 4d436c6f _deregisterTMClo
03d8 6e655461 626c6500 5f49544d 5f726567 neTable._ITM_reg
03e8 69737465 72544d43 6c6f6e65 5461626c isterTMCloneTabl
03f8 6500 e.

$ readelf --dyn-syms HelloWorld

Symbol table '.dynsym' contains 8 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
1: 0000000000000560 0 SECTION LOCAL DEFAULT 12
2: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_deregisterT[...]
3: 0000000000000000 0 FUNC GLOBAL DEFAULT UND _[...]@GLIBC_2.27 (2)
4: 0000000000000000 0 FUNC GLOBAL DEFAULT UND puts@GLIBC_2.27 (2)
5: 0000000000000000 0 FUNC WEAK DEFAULT UND _[...]@GLIBC_2.27 (2)
6: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_registerTMC[...]
7: 0000000000000624 32 FUNC GLOBAL DEFAULT 12 main
+ +

Notes on Build Hardening

Stack guards

To enable this stack protection, code is compiled with the option -fstack-protector. This looks for functions that have typical buffers, inserting the guard/canary on the stack when the function is entered, and then verifying the value hasn’t been overwritten before exit.

+

ASLR

When a buffer-overflow is exploited, a hacker will overwrite values pointing to specific locations in memory. That’s because locations, the layout of memory, are predictable. It’s a detail that programmers don’t know when they write the code, but something hackers can reverse-engineer when trying to figure how to exploit code.

+

Obviously a useful mitigation step would be to randomize the layout of memory, so nothing is in a predictable location. This is known as address space layout randomization or ASLR.

+

The word layout comes from the fact that the when a program runs, it’ll consist of several segments of memory. The basic list of segments are:

+
    +
  • the executable code
  • +
  • static values (like strings)
  • +
  • global variables
  • +
  • libraries
  • +
  • heap (growable)
  • +
  • stack (growable)
  • +
  • mmap()/VirtualAlloc() (random location)
  • +
+

The problem for executable code is that for ASLR to work, it must be made position independent. Historically, when code would call a function, it would jump to the fixed location in memory where that function was know to be located, thus it was dependent on the position in memory.

+

To fix this, code can be changed to jump to relative positions instead, where the code jumps at an offset from wherever it was jumping from.

+

To enable this on the compiler, the flag -fPIE (position independent executable) is used. Or, if building just a library and not a full executable program, the flag -fPIC (position independent code) is used.

+

Then, when linking a program composed of compiled files and libraries, the flag -pie or –static-pie is used. In other words, use -fPIE -pie when compiling executables, and -fPIC when compiling for libraries.

+

When compiled this way, exploits will no longer be able to jump directly into known locations for code.

+

RELRO

Modern systems have dynamic/shared libraries. Most of the code of a typical program consists of standard libraries. As mentioned above, the GNU standard library glibc is 8-megabytes in size. Linking that into every one of hundreds of programs means gigabytes of disk space may be needed to store all the executables. It’s better to have a single file on the disk, libglibc.so, that all programs can share it.

+

The problem is that every program will load libraries into random locations. Therefore, code cannot jump to functions in the library, either with a fixed or relative address. To solve this, what position independent code does is jump to an entry in a table, relative to its own position. That table will then have the fixed location of the real function that it’ll jump to. When a library is loaded, that table is filled in with the correct values.

+

The problem is that hacker exploits can also write to that table. Therefore, what you need to do is make that table read-only after it’s been filled in. That’s done with the “relro” flag, meaning “relocation read-only”. An additional flag, “now”, must be set to force this behavior at program startup, rather than waiting until later.

+

When passed to the linker, these flags would be “**-z relro -z now“. However, we usually call the linker directly from the compiler, and pass the flags through. This is done in gcc by doing “-Wl,-z,relro -Wl,-z,now**“.

+

Non-executable stack

Exploiting a stack buffer overflow has three steps:

+
    +
  • figure out where the stack is located (mitigated by ASLR)
  • +
  • overwrite the stack frame control structure (mitigated by stack guards)
  • +
  • execute code in the buffer
  • +
+

We can mitigate the third step by preventing code from executing from stack buffers. The stack contains data, not code, so this shouldn’t be a problem. In much the same way that we can mark memory regions as read-only, we can mark them no-execute. This should be the default, of course, but as the paper above points out, there are some cases where code is actually placed on the stack.

+

This open can be set with -Wl,-z,noexecstack, when compiling both the executable and the libraries. This is the default, so you shouldn’t need to do anything special. However, as the paper points out, there are things that get in the way of this if you aren’t careful. The setting is more what you’d call “guidelines” than actual “rules”. Despite setting this flag, building software may result in an executable stack.

+

FORTIFY_SOURCE

One reason for so many buffer-overflow bugs is that the standard functions that copy buffers have no ability to verify whether they’ve gone past the end of a buffer. A common recommendation for code is to replace those inherently unsafe functions with safer alternatives that include length checks. For example the notoriously unsafe function strcpy() can be replaced with strlcpy(), which adds a length check.

+

Instead of editing the code, the GNU compiler can do this automatically. This is done with the build option -O2 -D_FORTIFY_SOURCE=2.

+

This is only a partial solution. The compiler can’t always figure out the size of the buffer being copied into, and thus will leave the code untouched. Only when the compiler can figure things out does it make the change.

+

Format string bugs

Because this post is about build hardening, I want to mention format-string bugs. This is a common bug in old code that can be caught by adding warnings for it in the build options, namely: -Wformat=2 -Wformat-security -Werror=format-security

+

Warnings and static analysis

When building code, the compiler will generate warnings about confusion, possible bugs, or bad style. The compiler has a default set of warnings. Robust code is compiled with the -Wall, meaning “all” warnings, though it actually doesn’t enable all of them. Paranoid code uses the -Wextra warnings to include those not included with -Wall. There is also the -pedantic or -Wpedantic flag, which warns on C compatibility issues.

+

All of these warnings can be converted into errors, which prevents the software from building, using the -Werror flag. As shown above, this can also be used with individual error names to make only some warnings into errors.

+

Optimization level

Compilers can optimize code, looking for common patterns, to make it go faster. You can set your desired optimization level.

+

Some things, namely the FORTIFY_SOURCE feature, don’t work without optimization enabled. That’s why in the above example, -O2 is specified, to set optimization level 2.

+

Higher levels aren’t recommended. For one thing, this doesn’t make code faster on modern, complex processors. The advanced processors you have in your desktop/mobile-phone themselves do extensive optimization. What they want is small code size that fits within cache. The -O3 level make code bigger, which is good for older, simpler processors, but is bad for modern, advanced processors.

+

In addition, the aggressive settings of -O3 have lead to security problems over “undefined behavior”. Even -O2 is a little suspect, with some guides suggesting the proper optimization is -O1. However, some optimizations are actually more secure than no optimizations, so for the security paranoid, -O1 should be considered the minimum.

+

Summary

If you are building code using gcc on Linux, here are the options/flags you should use: -Wall -Wformat -Wformat-security -Werror=format-security -fstack-protector -pie -fPIE -D_FORTIFY_SOURCE=2 -O2 -z defs -z noexecstack -z now -z relro -z text

+

If you are more paranoid, these options would be: -O2 -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wformat=2 -Wformat-security -Wstack-protector -Wdate-time -Werror -pedantic -fstack-protector-all -fstack-clash-protection -fPIE -pie -z defs -z noexecstack -z now -z relro -z text

+

Hardening Check

1
2
3
4
5
6
7
8
9
# hardening-check HelloWorld
HelloWorld:
Position Independent Executable: yes
Stack protected: yes
Fortify Source functions: unknown, no protectable libc functions used
Read-only relocations: yes
Immediate binding: yes
Stack clash protection: unknown, no -fstack-clash-protection instructions found
Control flow integrity: no, not found!
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2021/03/27/solid-principles/index.html b/2021/03/27/solid-principles/index.html new file mode 100644 index 00000000..00c06661 --- /dev/null +++ b/2021/03/27/solid-principles/index.html @@ -0,0 +1,255 @@ + + + + + + + + + + + + SOLID Principles | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ SOLID Principles +

+ +

SOLID Principles

In a nutshell

SOLID Principles makes your code more extendable, logical, and easier to read. When the developer builds software following a bad design, the code can become inflexible and more brittle. Small changes in the software can result in bugs. For these reasons, we should follow SOLID Principles.

+

SOLID Principles

+

What is S.O.L.I.D

SOLID is an acronym that represents five principles very important when we develop with the OOP paradigm, in addition, it is essential knowledge that every developer must know.

+

Understanding and applying these principles will allow you to write better quality code and therefore be a better developer.

+

These 5 principles were introduced by Robert C. Martin (Uncle Bob), in his Design Principles and Design Patterns book. The actual SOLID acronym was, however, identified later by Michael Feathers.

+

Why S.O.L.I.D Principles

These principles, when combined together, make it easy for a programmer to develop software that is easy to maintain and extend. They also make it easy for developers to avoid code smells, easily refactor code, and are also a part of agile or adaptive software development.

+

Let’s break down the letters of SOLID and see the details of each of these.

+

Advantages of SOLID Principles

    +
  • Principled way of managing dependencies especially in a large application.
  • +
  • Loose coupling (degree of interdependence between software modules)
  • +
  • More cohesion (the degree to which the elements of a module belong together)
  • +
  • Code is more reusable, robust, flexible, testable, and maintainable
  • +
+

Single Responsibility Principle (SRP)

+

A class should have one and only one reason to change, meaning that a class should have only one job.

+
+
    +
  • Simple Definition: Do not burden one class with too many responsibilities.

    +
  • +
  • Advantages: Increase cohesion, low coupling, reduced complexity.

    +
  • +
+

Open-Closed Principle (OCP)

+

Objects or entities should be open for extension but closed for modification.

+
+
    +
  • Simple Definition: You should be able to extend a class’s behavior, without modifying it.

    +
  • +
  • Other definition: Ideally, once a class is done, it’s done.

    +
  • +
  • Advantages: Increased cohesion, extensible code, less chance of introducing bugs in the existing application.

    +
  • +
+

Liskov Substitution Principle (LSP)

+

Objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program.

+
+
    +
  • Simple Definition: Objects of the derived class must behave in a manner consistent with the promises made in the base class’ contract.

    +
  • +
  • Other definition: All derived classes should be exact sub-types of the base class not kind of sub-types.

    +
  • +
  • **Advantages&&: Code re-usability, reduced coupling, and less chance of introducing bugs in the existing application.

    +
  • +
+

Interface Segregation Principle (ISP)

+

many client-specific interfaces are better than one general-purpose interface.

+
+
    +
  • Simple Definition: Clients should not be forced to implement interfaces they do not use.

    +
  • +
  • Other definition: Break down a large class into smaller manageable interfaces

    +
  • +
  • Advantages: Increased cohesion, more extensible, and robust.

    +
  • +
+

Dependency Inversion Principle (DIP)

+

High-level modules should not depend on low-level modules. Both should depend on abstractions.

+

Abstractions should not depend on details. Details should depend on abstractions.

+
+
    +
  • Simple Definition: Entities must depend on abstractions, not on concretions.”

    +
  • +
  • Other definition: Anytime I new up a class it’s time to look at DIP

    +
  • +
  • Advantages: Loose coupling.

    +
  • +
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2021/03/27/solid-principles/solid-principles.png b/2021/03/27/solid-principles/solid-principles.png new file mode 100644 index 00000000..71bc2876 Binary files /dev/null and b/2021/03/27/solid-principles/solid-principles.png differ diff --git a/2021/03/28/microservices-architecture-principles/choreography.png b/2021/03/28/microservices-architecture-principles/choreography.png new file mode 100644 index 00000000..d3c78dda Binary files /dev/null and b/2021/03/28/microservices-architecture-principles/choreography.png differ diff --git a/2021/03/28/microservices-architecture-principles/index.html b/2021/03/28/microservices-architecture-principles/index.html new file mode 100644 index 00000000..616caf6d --- /dev/null +++ b/2021/03/28/microservices-architecture-principles/index.html @@ -0,0 +1,252 @@ + + + + + + + + + + + + Microservices Architecture Principles | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Microservices Architecture Principles +

+ +

Microservices Architecture Principles

What is a microservices architecture

Essentially, microservices architecture is a method of software development that aims to break down an application to isolate key functions, each of these functions is called a “service”. These services are designed to meet a specific and unique business need, for example: user management, payments, sending emails or even notifications. In addition, they are independent and modular, this allows each to be developed and deployed without affecting the others. This type of architecture is intended to be the opposite of monolithic architectures which are built as a single autonomous unit.

+

This definition may recall another type of architecture quite similar, Service Oriented Architecture (SOA), a software design already well stated.

+

What makes an SOA architecture different from a microservices architecture?

+

Let’s start with a clear observation, made by the precursors of microservices: this architecture is an extension of the concept of SOA. Most of the design principles for microservices were already available in the SOA world. Some people claim that “the microservices architecture is a well-designed SOA architecture.” Let’s see the differences between SOA and microservices along several axes:

+
    +
  • Size: One of the big differences is the size and scope of services. As you can guess from the name, in microservices, the size of each service is much smaller than the one of SOA services. In a microservices architecture, each service has a single responsibility while in the SOA architecture, services can contain many business functions.

    +
  • +
  • Reusability: One of the goals of SOA is to reuse components without worrying about coupling while in microservices we try to minimize reuse since this creates dependencies that reduce agility and resiliency. A weak coupling is preferred, even if it means having code duplication.

    +
  • +
  • Communication: In SOA, communication between services is usually done synchronously through an enterprise service bus (ESB), this introduces a critical point of failure and latency. In a microservices application, fault tolerance is better thanks to the independence of each service, asynchronous communication is also privileged between services (for example a publish subscribe model can be used to allow a service to stay up to date on changes to another one’s data), enabling high availability.

    +
  • +
  • Data duplication: One of the goals of an SOA is to allow all applications to access data synchronously directly at the source. With a microservices architecture, each service has access to all the data it needs locally (ideally) to have maximum performance and agility, even if this means having to duplicate data and therefore add complexity.

    +
  • +
+

Let’s sum it all up with a diagram:

+

Monolith, SOA and Microservices Architecture

+

Advantages and disadvantages of a microservices architecture

Now that we have a better understanding of what a microservices architecture is, let’s see what are the advantages and disadvantages of it compared to a monolith architecture. We’ve seen a number of benefits before, but let’s go over them all:

+

Advantages

    +
  • Independent Development: Teams can choose the technologies that best suit each service using various technology stacks and are not limited by the choices made at the start of the project. Additionally, a single development team can build, test, and deploy a service, enabling faster deployment and facilitating continuous innovation. It is also more difficult to make mistakes since there are strong boundaries between the different services.

    +
  • +
  • Independent deployment: Microservices are deployed independently. A service can be updated without having to redeploy the entire application, making it easier to manage bug fixes and new features. This simplifies integration and continuous deployment. In many traditional applications, if there is a bug in one part of the application, it can block the entire release process.

    +
  • +
  • Independent scaling: Services can scale independently to suit needs, optimizing costs and time since there is no need to scale the entire application as you would with a monolith.

    +
  • +
  • Small Targeted Teams: Teams can be targeted to only one service, making code easier to understand and making it easier for new members to join the team, no need to spend weeks figuring out how a complex monolith works. It also promotes flexibility, large teams tend to be less productive because communication is slower, management time increases and agility decreases.

    +
  • +
  • Small Code Base: In a monolithic application, code dependencies tend to get mixed up over time. Adding new functionality requires changing the code in a lot of places. In a microservices architecture, which does not share code or database, these dependencies are minimized, which makes it easier to add new features. It also complements the previous point that it makes it easier to understand the code and introduce new members to the team.

    +
  • +
  • Data isolation: In a microservices architecture, each service has private access to its database (ideally), we can then perform an update of the database schema without affecting the other services. In a monolithic application, schema updates can become very difficult and risky since multiple parts of the application can use the same data.

    +
  • +
  • Resilience: With a microservices architecture, critical points of failure are considerably reduced. When a service goes down, the whole application does not stop functioning as it does with the monolithic model and therefore the risk is also reduced when new features are developed. Errors are also isolated and therefore easier to correct.

    +
  • +
  • Technological Advances: Recent advancements in cloud technologies and containerization make setting up a microservices architecture increasingly simple. Every cloud provider has solutions for this type of architecture to make life easier for developers.

    +
  • +
+

Disadvantages

Now that we have a better idea of all the advantages of a microservices architecture, let’s see what the disadvantages and challenges are:

+
    +
  • Complexity: While each service is simpler, the system as a whole is more complex. Because this is a distributed system, care should be taken to select and set up all services and databases, and then deploy each of these components independently. All the challenges of a distributed system must be taken into account.

    +
  • +
  • Testing: Having multitude independent services can make writing tests more complex, especially when there are many dependencies between services. A mock must be used for each dependent service to be able to unit test a service.

    +
  • +
  • Data Integrity: Microservices have a distributed database architecture, which is a challenge for data integrity. Some business transactions, which require updating multiple business functions of the application, need to update multiple databases owned by different services. This requires setting up eventual consistency of data, which is obviously more complex and less intuitive for developers.

    +
  • +
  • Network latency: Using many small services can result in increased communications between services. Also, if you have a chain of dependency between services to perform a business transaction, the additional latency that results can become a problem. Asynchronous communications should be favored when usage permits, but this once again adds complexity to the system.

    +
  • +
+

According to these advantages and disadvantages it is then more or less relevant to adopt a microservices architecture, there is no universal rule, each project is unique and the motivations towards one architecture or the other depend on the needs and the context of it.

+

Orchestration vs Choreography

In a microservices architecture, it is inevitable that some services need to communicate with each other, these communications can be achieved in two ways, orchestration or choreography. A lot of documentation exists on these two models, including a publication by Chaitanya Rudrabhatla in the International Journal of Advanced Computer Science and Applications (IJACSA), executive director and architect at Sony Pictures Entertainment.

+

Orchestration

The first intuitive idea to make the services communicate with each other is quite simply to make REST calls between the services:

+

Make REST calls between the services

+

This approach is simple to set up but the system quickly becomes complex to maintain since we introduce dependencies between services, which we want to avoid as much as possible. A more thoughtful way to do this transaction is to introduce an additional abstraction with a new service, an orchestrator:

+

Orchestrator

+

The orchestrator is the only one to have knowledge of the other services, in case of an update of the services, it will still be necessary to be careful not to “break” the orchestrator, but we have the advantage that it is the only one affected by the changes. However, with this approach or the previous one, there are still drawbacks which are the latency this can introduce due to synchronous calls, and poor fault tolerance. Also on a system made up of a large amount of services, one can quickly come up with a system with a lot of dependencies that looks like a distributed monolith. Orchestration should therefore be used sparingly.

+

Choreography

The choreography overcomes the various disadvantages of orchestration, there is no dependency or latency in the system. The solution is to use events with a publish-subscribe model:

+

Choreography

+

When an action is taken, the service in question will publish an event to which the other services will be able to subscribe to make the necessary changes. Communication is asynchronous and services are unaware of each other, therefore the system is efficient and easy to maintain on a large scale. In the event of a service failure, the system continues to operate, but the consistency of the data can be lost, the high availability of the system is favored, in cases where the consistency of the data is critical, it is completely possible to set up circuit breakers to automatically deactivate certain services.

+

Advice and good practices

The following tips and best practices are largely inspired by Michael Bryzek, co-founder and CTO at Flow.io, and his talk “Design microservice architectures the right way”, I truly recommend everyone to watch this video.

+

Microservices languages

We saw previously that one of the advantages of a microservices architecture is that each service can be developed with the language you want. In practice, it is advisable to limit the number of languages used as much as possible. This allows developers to easily switch teams and work on any service and be productive very quickly, even more if there is strong consistency between services. By limiting the number of languages, recruiting is also simplified.

+

API definition

An architecture driven by its specifications is the best way to produce quality APIs. API definitions can be made in JSON or YAML independently of the code (not generated with annotations) so as not to be dependent on the languages used in the services. All placed in a separate project that brings together all the specifications in order to have a single place to manage the specifications. It is then possible to set up a linter on this project to guarantee the consistency of style of all the APIs. In the definition of APIs, it is wise to provide a route to know the state of the service (example: “/health”) and also to provide for API versioning so as never to “break” anything for the users who use it.

+

Code generation

Thanks to a good definition of APIs, it is possible to generate code to create all the services. In this way we are certain that the definition really corresponds to what the services expose (the generated code must obviously not be modified, but must expose interfaces allowing to implement the necessary methods) and we also ensure a strong consistency. This avoids wasting time with repetitive tasks that have no added value. In this generation of code, you also have to plan for the generation of the necessary tests and mocks, it is important to think about this from the start to avoid it becoming very complex.

+

Databases

Each service has its own database that no other service can access. If this very important rule is lost, database updates become risky and complex since fixes must be made in all the services that access this database. If a service needs to make changes based on another service, it must go through its API or through events.

+

Continuous deployment

Continuous deployment is a prerequisite for managing a microservices architecture. Without continuous deployment, each service would have to be deployed by hand, which would be time consuming, error prone, and significantly slow down the time between each update.

+

Services communication

To allow communication between services, it is better to use event streams rather than using REST requests on APIs, only use APIs in case there is no other choice than to do a synchronous transaction. Using events with a publish-subscribe model reduces latency for users (since communication is asynchronous), and in the event of an error, it is possible to replay a chain of events if they were recorded in a newspaper. In addition, you can trace everything that has happened in the system easily. As with APIs, it is important to maintain an event schema specification that all developers can trust. Lastly, each event producer must have at least one recipient and each consumer must be idempotent.

+

Maintenance of dependencies

Maintaining a microservices architecture can be a challenge. Each service has dependencies that need to be updated while ensuring that the service continues to function properly. Depending on the number of architectural departments, this task can take a long time. Fortunately, this process can be automated with a script that runs every week (for example), and with the testing in place, we can ensure that the architecture continues to function.

+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2021/03/28/microservices-architecture-principles/monolith-soa-msa.png b/2021/03/28/microservices-architecture-principles/monolith-soa-msa.png new file mode 100644 index 00000000..aab1294b Binary files /dev/null and b/2021/03/28/microservices-architecture-principles/monolith-soa-msa.png differ diff --git a/2021/03/28/microservices-architecture-principles/orchestration-orchestrator.png b/2021/03/28/microservices-architecture-principles/orchestration-orchestrator.png new file mode 100644 index 00000000..20586a11 Binary files /dev/null and b/2021/03/28/microservices-architecture-principles/orchestration-orchestrator.png differ diff --git a/2021/03/28/microservices-architecture-principles/orchestration-rest.png b/2021/03/28/microservices-architecture-principles/orchestration-rest.png new file mode 100644 index 00000000..aba5879a Binary files /dev/null and b/2021/03/28/microservices-architecture-principles/orchestration-rest.png differ diff --git a/2021/04/03/dart-programming-language/index.html b/2021/04/03/dart-programming-language/index.html new file mode 100644 index 00000000..3cca8ed7 --- /dev/null +++ b/2021/04/03/dart-programming-language/index.html @@ -0,0 +1,217 @@ + + + + + + + + + + + + Dart programming language | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Dart programming language +

+ +

Dart programming language

Dart overview

Dart is a client-optimized language for developing fast apps on any platform. Its goal is to offer the most productive programming language for multi-platform development, paired with a flexible execution runtime platform for app frameworks.

+
    +
  • Optimized for UI
  • +
  • Productive development
  • +
  • Fast on all platforms
  • +
+

Learning Dart

+

Get the Dart SDK

Stable, beta, and dev channel releases are available at URLs like the following:

+
1
https://storage.googleapis.com/dart-archive/channels/<stable|beta|dev>/release/<version>/sdk/dartsdk-<platform>-<architecture>-release.zip
+ + +

HelloWorld.dart

1
2
3
4
5
$ cat << EOF > HelloWorld.dart
void main() {
print('Hello, World!');
}
EOF
+ +

Dart on Windows

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
C:\>dart run HelloWorld.dart
Hello, World!

C:\>dart compile exe -o HelloWorld.exe HelloWorld.dart
Info: Compiling with sound null safety
Generated: helloworld.exe

C:\>helloworld.exe
Hello, World!

C:\>du -ks helloworld.exe
4836 helloworld.exe

C:\>file helloworld.exe
helloworld.exe: PE32+ executable (console) x86-64, for MS Windows

C:\>dumpbin /NOLOGO /DEPENDENTS helloworld.exe
Dump of file helloworld.exe

File Type: EXECUTABLE IMAGE

Image has the following dependencies:

IPHLPAPI.DLL
PSAPI.DLL
WS2_32.dll
RPCRT4.dll
SHLWAPI.dll
ADVAPI32.dll
SHELL32.dll
dbghelp.dll
CRYPT32.dll
KERNEL32.dll

Summary

41000 .data
16000 .pdata
CB000 .rdata
A000 .reloc
2AB000 .text
+ +

Dart on Linux

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
$ dart run HelloWorld.dart
Hello, World!

$ dart compile exe -o HelloWorld HelloWorld.dart
Info: Compiling with sound null safety
Generated: HelloWorld

$ ./HelloWorld
Hello, World!

$ du -ks HelloWorld
5736 HelloWorld

$ file HelloWorld
HelloWorld: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, stripped

$ readelf -hld HelloWorld
ld-linux-x86-64.so.2
libc.so.6
libdl.so.2
libm.so.6
libpthread.so.0
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2021/04/04/time-of-haskell/index.html b/2021/04/04/time-of-haskell/index.html new file mode 100644 index 00000000..0b5e9658 --- /dev/null +++ b/2021/04/04/time-of-haskell/index.html @@ -0,0 +1,211 @@ + + + + + + + + + + + + Time of Haskell | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Time of Haskell +

+ +

Time of Haskell

Handling timezones correctly, along with the distinction between timestamps and calendar dates is an endless source of bugs. Being precise about which exact type of time data your program takes in and spits out can completely obviate that problem.

+

The de-facto standard date and time library in Haskell, time, however, can be a little obtuse to get started with. Here’s a cheatsheet for the most common use cases for the time library.

+

Importing and using time library

Add to your package.yaml file:

+
1
2
dependencies:
- time
+ +

In modules where you need to work with date/time data:

+
1
import Data.Time
+ +

In GHCi:

+
1
Prelude> import Data.Time
+ +

The primitive type in the time library is UTCTime. If you need to do anything involving the current time, it will most likely involve some conversion from/to this type. As the name suggests, it’s a timestamp in the UTC timezone.

+

Get time resolution

1
2
3
Prelude> import Data.Time
Prelude Data.Time> getTime_resolution
0.0000001s
+ +

Getting the POSIX time

1
2
3
Prelude> import Data.Time.Clock.POSIX
Prelude Data.Time.Clock.POSIX> getPOSIXTime
1628354752.8489337s
+ +

Getting the current time

1
2
3
4
Prelude> import Data.Time

Prelude Data.Time> getCurrentTime
2021-04-03 16:22:38.674402 UTC
+ +

Getting the system time

1
2
3
Prelude> import Data.Time.Clock.System
Prelude Data.Time.Clock.System> getSystemTime
MkSystemTime {systemSeconds = 1628354836, systemNanoseconds = 564557100}
+ +

Working with time

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Prelude> import Data.Time
Prelude Data.Time> fromGregorian 2020 2 31
2020-02-29

Prelude Data.Time> fromGregorianValid 2020 2 31
Nothing

Prelude Data.Time> fromGregorianValid 2019 10 7
Just 2019-10-07

Prelude Data.Time> start <- getCurrentTime
Prelude Data.Time> now <- getCurrentTime
Prelude Data.Time> diffUTCTime now start
6.6531334s

Prelude Data.Time> now
2021-04-03 16:37:51.7175715 UTC
Prelude Data.Time> addUTCTime 5 now
2021-04-03 16:37:56.7175715 UTC
+ +

Formatting dates and times

1
2
3
4
5
6
Prelude> import Data.Time
Prelude Data.Time> now <- getCurrentTime
Prelude Data.Time> now
2021-04-03 16:32:43.4961349 UTC
Prelude Data.Time> formatTime defaultTimeLocale "%_Y-%m-%dT%H:%M:%S.%q%z" now
"2021-04-03T16:32:43.496134900000+0000"
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2021/04/05/net-on-linux/index.html b/2021/04/05/net-on-linux/index.html new file mode 100644 index 00000000..1b419ecf --- /dev/null +++ b/2021/04/05/net-on-linux/index.html @@ -0,0 +1,260 @@ + + + + + + + + + + + + .NET on Linux | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ .NET on Linux +

+ +

.NET on Linux

Supported Versions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
VersionStatusLatest releaseGeneral availableEnd of support
.NET 5.0Current5.0.52020-11-10&nbsp;
.NET Core 3.1LTS3.1.132019-12-032022-12-03
.NET Core 2.1LTS2.1.262018-05-302021-08-21
+

Supported Linux

    +
  • Alpine 3.11, 3.12
  • +
  • Debian 9, 10
  • +
  • Fedora 32, 33
  • +
  • RHEL 7, 8
  • +
  • SLES 12, 15
  • +
  • Ubuntu 18.04, 20.04
  • +
+

Download .NET

+

.NET in Docker

1
2
3
4
docker pull mcr.microsoft.com/dotnet/sdk:5.0
docker pull mcr.microsoft.com/dotnet/sdk:3.1
docker pull mcr.microsoft.com/dotnet/sdk:2.1
docker pull mcr.microsoft.com/dotnet/framework/sdk:4.8
+ +

Install .NET on Linux

+

Hello World in 10 minutes

Check everything installed correctly

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
$ dotnet  --info
.NET SDK (reflecting any global.json):
Version: 5.0.202
Commit: db7cc87d51

Runtime Environment:
OS Name: ubuntu
OS Version: 20.04
OS Platform: Linux
RID: ubuntu.20.04-x64
Base Path: /opt/dotnet-sdk-5/sdk/5.0.202/

Host (useful for support):
Version: 5.0.5
Commit: 2f740adc14

.NET SDKs installed:
3.1.407 [/opt/dotnet-sdk-5/sdk]
5.0.202 [/opt/dotnet-sdk-5/sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 3.1.13 [/opt/dotnet-sdk-5/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.5 [/opt/dotnet-sdk-5/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.13 [/opt/dotnet-sdk-5/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.5 [/opt/dotnet-sdk-5/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs:
https://aka.ms/dotnet-download
+ +

Create your app

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
$ dotnet new console -o myApp

Welcome to .NET 5.0!
---------------------
SDK Version: 5.0.202

Telemetry
---------
The .NET tools collect usage data in order to help us improve your experience. It is collected by Microsoft and shared w
ith the community. You can opt-out of telemetry by setting the DOTNET_CLI_TELEMETRY_OPTOUT environment variable to '1' o
r 'true' using your favorite shell.

Read more about .NET CLI Tools telemetry: https://aka.ms/dotnet-cli-telemetry

----------------
Installed an ASP.NET Core HTTPS development certificate.
To trust the certificate run 'dotnet dev-certs https --trust' (Windows and macOS only).
Learn about HTTPS: https://aka.ms/dotnet-https
----------------
Write your first app: https://aka.ms/dotnet-hello-world
Find out what's new: https://aka.ms/dotnet-whats-new
Explore documentation: https://aka.ms/dotnet-docs
Report issues and find source on GitHub: https://github.com/dotnet/core
Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli
--------------------------------------------------------------------------------------
Getting ready...
The template "Console Application" was created successfully.

Processing post-creation actions...
Running 'dotnet restore' on myApp/myApp.csproj...
Determining projects to restore...
Restored /tmp/x/myApp/myApp.csproj (in 75 ms).
Restore succeeded.
+ +

Run your app

1
2
3
4
5
6
$ find myApp/ -type f
myApp/Program.cs
myApp/myApp.csproj

$ dotnet run
Hello World!
+ +

Build your app

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
$ dotnet build -c Release
Microsoft (R) Build Engine version 16.9.0+57a23d249 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

Determining projects to restore...
Restored /tmp/x/myApp/myApp.csproj (in 78 ms).
myApp -> /tmp/x/myApp/bin/Release/net5.0/myApp.dll

Build succeeded.
0 Warning(s)
0 Error(s)

Time Elapsed 00:00:01.34

$ find /tmp/x/myApp/bin/Release/ -type f
/tmp/x/myApp/bin/Release/net5.0/myApp.deps.json
/tmp/x/myApp/bin/Release/net5.0/myApp.runtimeconfig.json
/tmp/x/myApp/bin/Release/net5.0/myApp.pdb
/tmp/x/myApp/bin/Release/net5.0/myApp.dll
/tmp/x/myApp/bin/Release/net5.0/myApp
/tmp/x/myApp/bin/Release/net5.0/ref/myApp.dll
/tmp/x/myApp/bin/Release/net5.0/myApp.runtimeconfig.dev.json
+ +

Publish your app

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$ dotnet publish -c Release
Microsoft (R) Build Engine version 16.9.0+57a23d249 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

Determining projects to restore...
All projects are up-to-date for restore.
myApp -> /tmp/x/myApp/bin/Release/net5.0/myApp.dll
myApp -> /tmp/x/myApp/bin/Release/net5.0/publish/

$ find bin/Release/net5.0/publish/ -type f
bin/Release/net5.0/publish/myApp.deps.json
bin/Release/net5.0/publish/myApp.runtimeconfig.json
bin/Release/net5.0/publish/myApp.pdb
bin/Release/net5.0/publish/myApp.dll
bin/Release/net5.0/publish/myApp
+ +

Publish the .NET runtime with your app

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
$ dotnet publish -c Release --runtime linux-x64
Microsoft (R) Build Engine version 16.9.0+57a23d249 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

Determining projects to restore...


Restored /tmp/x/myApp/myApp.csproj (in 1.43 min).
myApp -> /tmp/x/myApp/bin/Release/net5.0/linux-x64/myApp.dll
myApp -> /tmp/x/myApp/bin/Release/net5.0/linux-x64/publish/

$ /tmp/x/myApp/bin/Release/net5.0/linux-x64/myApp
Hello World!

$ du -ks /tmp/x/myApp/bin/Release/net5.0/linux-x64
147756 /tmp/x/myApp/bin/Release/net5.0/linux-x64

$ find /tmp/x/myApp/bin/Release/net5.0/linux-x64 -type f | wc -l
374
+ +

Publish Single File with your app

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
$ dotnet publish -c Release --runtime linux-x64 -p:PublishSingleFile=true
Microsoft (R) Build Engine version 16.9.0+57a23d249 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

Determining projects to restore...
All projects are up-to-date for restore.
myApp -> /tmp/x/myApp/bin/Release/net5.0/linux-x64/myApp.dll
myApp -> /tmp/x/myApp/bin/Release/net5.0/linux-x64/publish/

$ /tmp/x/myApp/bin/Release/net5.0/linux-x64/myApp
Hello World!

$ du -ks /tmp/x/myApp/bin/Release/net5.0/linux-x64
145140 /tmp/x/myApp/bin/Release/net5.0/linux-x64

$ find /tmp/x/myApp/bin/Release/net5.0/linux-x64 -type f | wc -l
190
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2021/04/10/prometheus-query-language/index.html b/2021/04/10/prometheus-query-language/index.html new file mode 100644 index 00000000..8531b6ea --- /dev/null +++ b/2021/04/10/prometheus-query-language/index.html @@ -0,0 +1,248 @@ + + + + + + + + + + + + Prometheus Query Language | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Prometheus Query Language +

+ +

Prometheus Query Language

Querying Prometheus reference

+

Setup Prometheus

The Java demo code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

@Scheduled(fixedDelay = 1000)
public void simulator() {
int[] values = new int[]{100, 300, 400, 1600, 500, 200};
Tags[] tagsList = new Tags[]{
Tags.of("api", "", "app", ""),
Tags.of("api", "bdt-sbi", "app", "bdt"),
Tags.of("api", "cp-sbi", "app", "cp"),
Tags.of("api", "ee-sbi", "app", "ee"),
Tags.of("api", "qos-sbi", "app", "qos"),
Tags.of("api", "afi-sbi", "app", "afi")
};
Random random = new SecureRandom();
for (int i = 0; i < 6; i++) {
Tags tags = tagsList[i];
meterRegistry.counter("api_north_requests_recv_total", tags)
.increment(values[i]);
meterRegistry.gauge("connected_device_gauge", tags, new AtomicInteger(0))
.set(values[i]);
Timer.builder("database_access_time").tags(tags)
.publishPercentiles(0.75, 0.8, 0.85, 0.9, 0.95, 0.99, 0.999)
.publishPercentileHistogram()
.minimumExpectedValue(Duration.ofMillis(1))
.maximumExpectedValue(Duration.ofSeconds(30))
.register(meterRegistry)
.record(Duration.ofMillis((int) (random.nextDouble() * 30_000)));
}
}
+ +

prometheus.yml

1
2
3
4
5
6
7
8
9
10
11
12
13
global:
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.

# A list of scrape configurations.
scrape_configs:
- job_name: 'prometheus-localhost-9090'
static_configs:
- targets: ['localhost:9090']

- job_name: 'simulator-localhost-8181'
static_configs:
- targets: ['localhost:8181']
+ +

Start Java service and Prometheus

1
2
3
4
5
6
java -jar /path/to/java/service/jar &

prometheus --web.enable-admin-api \
--storage.tsdb.retention.time=3d \
--storage.tsdb.retention.size=512MB \
--storage.tsdb.path=data/
+ +

Querying Prometheus status

Querying Prometheus config

1
2
3
4
5
6
7
$ curl -sSL http://localhost:9090/api/v1/status/config | jq .
{
"status": "success",
"data": {
"yaml": "global:\n scrape_interval: 15s\n scrape_timeout: 10s\n evaluation_interval: 15s\n query_log_file: query_log.txt\nscrape_configs:\n- job_name: prometheus-localhost-9090\n honor_timestamps: true\n scrape_interval: 15s\n scrape_timeout: 10s\n metrics_path: /metrics\n scheme: http\n static_configs:\n - targets:\n - localhost:9090\n- job_name: simulator-localhost-8181\n honor_timestamps: true\n scrape_interval: 15s\n scrape_timeout: 10s\n metrics_path: /metrics\n scheme: http\n static_configs:\n - targets:\n - localhost:8181\n"
}
}
+ +

Querying Prometheus flags

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
$ curl -sSL http://localhost:9090/api/v1/status/flags | jq .
{
"status": "success",
"data": {
"alertmanager.notification-queue-capacity": "10000",
"alertmanager.timeout": "",
"config.file": "prometheus.yml",
"enable-feature": "",
"log.format": "logfmt",
"log.level": "info",
"query.lookback-delta": "5m",
"query.max-concurrency": "20",
"query.max-samples": "50000000",
"query.timeout": "2m",
"rules.alert.for-grace-period": "10m",
"rules.alert.for-outage-tolerance": "1h",
"rules.alert.resend-delay": "1m",
"scrape.adjust-timestamps": "true",
"storage.remote.flush-deadline": "1m",
"storage.remote.read-concurrent-limit": "10",
"storage.remote.read-max-bytes-in-frame": "1048576",
"storage.remote.read-sample-limit": "50000000",
"storage.tsdb.allow-overlapping-blocks": "false",
"storage.tsdb.max-block-duration": "6m",
"storage.tsdb.min-block-duration": "2h",
"storage.tsdb.no-lockfile": "false",
"storage.tsdb.path": "data/",
"storage.tsdb.retention": "0s",
"storage.tsdb.retention.size": "0B",
"storage.tsdb.retention.time": "1h",
"storage.tsdb.wal-compression": "true",
"storage.tsdb.wal-segment-size": "0B",
"web.config.file": "",
"web.console.libraries": "console_libraries",
"web.console.templates": "consoles",
"web.cors.origin": ".*",
"web.enable-admin-api": "true",
"web.enable-lifecycle": "false",
"web.external-url": "",
"web.listen-address": "0.0.0.0:9090",
"web.max-connections": "512",
"web.page-title": "Prometheus Time Series Collection and Processing Server",
"web.read-timeout": "5m",
"web.route-prefix": "/",
"web.user-assets": ""
}
}
+ +

Querying Prometheus runtime information

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
$ curl -sSL http://localhost:9090/api/v1/status/runtimeinfo | jq .
{
"status": "success",
"data": {
"startTime": "2021-04-10T03:11:30.8916173Z",
"CWD": "C:\\opt\\prometheus",
"reloadConfigSuccess": true,
"lastConfigTime": "2021-04-10T03:11:31Z",
"corruptionCount": 0,
"goroutineCount": 30,
"GOMAXPROCS": 8,
"GOGC": "",
"GODEBUG": "",
"storageRetention": "1h"
}
}
+ +

Querying Prometheus build information

1
2
3
4
5
6
7
8
9
10
11
12
$ curl -sSL http://localhost:9090/api/v1/status/buildinfo | jq .
{
"status": "success",
"data": {
"version": "2.25.2",
"revision": "bda05a23ada314a0b9806a362da39b7a1a4e04c3",
"branch": "HEAD",
"buildUser": "root@de38ec01ef10",
"buildDate": "20210316-18:20:38",
"goVersion": "go1.15.10"
}
}
+ +

Querying Prometheus TSDB Stats

1
2
3
4
5
6
7
8
9
10
11
12
13
$ curl -sSL http://localhost:9090/api/v1/status/tsdb | jq .
{
"status": "success",
"data": {
"headStats": {
"numSeries": 635,
"numLabelPairs": 398,
"chunkCount": 1656,
"minTime": 1618024298730,
"maxTime": 1618030645198
}
}
}
+ +

Clean tombstones of Prometheus

1
2
3
4
5
6
7
8
9
10
11
$ curl -sSL -X POST http://localhost:9090/api/v1/admin/tsdb/clean_tombstones | jq .
{
"status": "error",
"errorType": "unavailable",
"error": "admin APIs disabled"
}

# prometheus --storage.tsdb.retention.time=1h --web.enable-admin-api
$ curl -i -sSL -X POST http://localhost:9090/api/v1/admin/tsdb/clean_tombstones
HTTP/1.1 204 No Content
Date: Sat, 10 Apr 2021 05:03:29 GMT
+ +

Querying metric metadata

List metrics

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
$ curl -sSL http://localhost:9090/api/v1/metadata?limit=3 | jq .
{
"status": "success",
"data": {
"go_goroutines": [
{
"type": "gauge",
"help": "Number of goroutines that currently exist.",
"unit": ""
}
],
"go_memstats_mallocs_total": [
{
"type": "counter",
"help": "Total number of mallocs.",
"unit": ""
}
],
"prometheus_tsdb_head_series": [
{
"type": "gauge",
"help": "Total number of series in the head block.",
"unit": ""
}
]
}
}
+ +

List metrics - jq

1
2
3
4
5
6
7
8
$ curl -sSL http://localhost:9090/api/v1/metadata | jq '.data.system_cpu_usage'
[
{
"type": "gauge",
"help": "The \"recent cpu usage\" for the whole system",
"unit": ""
}
]
+ +

List metrics - keys

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
$ curl -sSL http://localhost:9090/api/v1/metadata | jq '.data | to_entries | .[].key' | tr -d '"'
api_north_requests_recv_total
connected_device_gauge
go_gc_duration_seconds
go_goroutines
go_info
go_memstats_alloc_bytes
go_memstats_alloc_bytes_total
go_memstats_buck_hash_sys_bytes
go_memstats_frees_total
go_memstats_gc_cpu_fraction
go_memstats_gc_sys_bytes
go_memstats_heap_alloc_bytes
go_memstats_heap_idle_bytes
go_memstats_heap_inuse_bytes
go_memstats_heap_objects
go_memstats_heap_released_bytes
go_memstats_heap_sys_bytes
go_memstats_last_gc_time_seconds
go_memstats_lookups_total
go_memstats_mallocs_total
go_memstats_mcache_inuse_bytes
go_memstats_mcache_sys_bytes
go_memstats_mspan_inuse_bytes
go_memstats_mspan_sys_bytes
go_memstats_next_gc_bytes
go_memstats_other_sys_bytes
go_memstats_stack_inuse_bytes
go_memstats_stack_sys_bytes
go_memstats_sys_bytes
go_threads
http_server_requests_seconds
http_server_requests_seconds_max
jvm_buffer_count_buffers
jvm_buffer_memory_used_bytes
jvm_buffer_total_capacity_bytes
jvm_classes_loaded_classes
jvm_classes_unloaded_classes_total
jvm_gc_live_data_size_bytes
jvm_gc_max_data_size_bytes
jvm_gc_memory_allocated_bytes_total
jvm_gc_memory_promoted_bytes_total
jvm_memory_committed_bytes
jvm_memory_max_bytes
jvm_memory_used_bytes
jvm_threads_daemon_threads
jvm_threads_live_threads
jvm_threads_peak_threads
jvm_threads_states_threads
logback_events_total
net_conntrack_dialer_conn_attempted_total
net_conntrack_dialer_conn_closed_total
net_conntrack_dialer_conn_established_total
net_conntrack_dialer_conn_failed_total
net_conntrack_listener_conn_accepted_total
net_conntrack_listener_conn_closed_total
process_cpu_seconds_total
process_cpu_usage
process_max_fds
process_open_fds
process_resident_memory_bytes
process_start_time_seconds
process_uptime_seconds
process_virtual_memory_bytes
prometheus_api_remote_read_queries
prometheus_build_info
prometheus_config_last_reload_success_timestamp_seconds
prometheus_config_last_reload_successful
prometheus_engine_queries
prometheus_engine_queries_concurrent_max
prometheus_engine_query_duration_seconds
prometheus_engine_query_log_enabled
prometheus_engine_query_log_failures_total
prometheus_http_request_duration_seconds
prometheus_http_requests_total
prometheus_http_response_size_bytes
prometheus_notifications_alertmanagers_discovered
prometheus_notifications_dropped_total
prometheus_notifications_queue_capacity
prometheus_notifications_queue_length
prometheus_remote_storage_highest_timestamp_in_seconds
prometheus_remote_storage_samples_in_total
prometheus_remote_storage_string_interner_zero_reference_releases_total
prometheus_rule_evaluation_duration_seconds
prometheus_rule_group_duration_seconds
prometheus_sd_consul_rpc_duration_seconds
prometheus_sd_consul_rpc_failures_total
prometheus_sd_discovered_targets
prometheus_sd_dns_lookup_failures_total
prometheus_sd_dns_lookups_total
prometheus_sd_failed_configs
prometheus_sd_file_read_errors_total
prometheus_sd_file_scan_duration_seconds
prometheus_sd_kubernetes_events_total
prometheus_sd_received_updates_total
prometheus_sd_updates_total
prometheus_target_interval_length_seconds
prometheus_target_metadata_cache_bytes
prometheus_target_metadata_cache_entries
prometheus_target_scrape_pool_exceeded_target_limit_total
prometheus_target_scrape_pool_reloads_failed_total
prometheus_target_scrape_pool_reloads_total
prometheus_target_scrape_pool_sync_total
prometheus_target_scrape_pool_targets
prometheus_target_scrape_pools_failed_total
prometheus_target_scrape_pools_total
prometheus_target_scrapes_cache_flush_forced_total
prometheus_target_scrapes_exceeded_sample_limit_total
prometheus_target_scrapes_sample_duplicate_timestamp_total
prometheus_target_scrapes_sample_out_of_bounds_total
prometheus_target_scrapes_sample_out_of_order_total
prometheus_target_sync_length_seconds
prometheus_template_text_expansion_failures_total
prometheus_template_text_expansions_total
prometheus_treecache_watcher_goroutines
prometheus_treecache_zookeeper_failures_total
prometheus_tsdb_blocks_loaded
prometheus_tsdb_checkpoint_creations_failed_total
prometheus_tsdb_checkpoint_creations_total
prometheus_tsdb_checkpoint_deletions_failed_total
prometheus_tsdb_checkpoint_deletions_total
prometheus_tsdb_compaction_chunk_range_seconds
prometheus_tsdb_compaction_chunk_samples
prometheus_tsdb_compaction_chunk_size_bytes
prometheus_tsdb_compaction_duration_seconds
prometheus_tsdb_compaction_populating_block
prometheus_tsdb_compactions_failed_total
prometheus_tsdb_compactions_skipped_total
prometheus_tsdb_compactions_total
prometheus_tsdb_compactions_triggered_total
prometheus_tsdb_data_replay_duration_seconds
prometheus_tsdb_head_active_appenders
prometheus_tsdb_head_chunks
prometheus_tsdb_head_chunks_created_total
prometheus_tsdb_head_chunks_removed_total
prometheus_tsdb_head_gc_duration_seconds
prometheus_tsdb_head_max_time
prometheus_tsdb_head_max_time_seconds
prometheus_tsdb_head_min_time
prometheus_tsdb_head_min_time_seconds
prometheus_tsdb_head_samples_appended_total
prometheus_tsdb_head_series
prometheus_tsdb_head_series_created_total
prometheus_tsdb_head_series_not_found_total
prometheus_tsdb_head_series_removed_total
prometheus_tsdb_head_truncations_failed_total
prometheus_tsdb_head_truncations_total
prometheus_tsdb_isolation_high_watermark
prometheus_tsdb_isolation_low_watermark
prometheus_tsdb_lowest_timestamp
prometheus_tsdb_lowest_timestamp_seconds
prometheus_tsdb_mmap_chunk_corruptions_total
prometheus_tsdb_out_of_bound_samples_total
prometheus_tsdb_out_of_order_samples_total
prometheus_tsdb_reloads_failures_total
prometheus_tsdb_reloads_total
prometheus_tsdb_retention_limit_bytes
prometheus_tsdb_size_retentions_total
prometheus_tsdb_storage_blocks_bytes
prometheus_tsdb_symbol_table_size_bytes
prometheus_tsdb_time_retentions_total
prometheus_tsdb_tombstone_cleanup_seconds
prometheus_tsdb_vertical_compactions_total
prometheus_tsdb_wal_completed_pages_total
prometheus_tsdb_wal_corruptions_total
prometheus_tsdb_wal_fsync_duration_seconds
prometheus_tsdb_wal_page_flushes_total
prometheus_tsdb_wal_segment_current
prometheus_tsdb_wal_truncate_duration_seconds
prometheus_tsdb_wal_truncations_failed_total
prometheus_tsdb_wal_truncations_total
prometheus_tsdb_wal_writes_failed_total
prometheus_web_federation_errors_total
prometheus_web_federation_warnings_total
promhttp_metric_handler_requests_in_flight
promhttp_metric_handler_requests_total
system_cpu_count
system_cpu_usage
+ +

List labels

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
$ curl -sSL 'http://localhost:9090/api/v1/labels' | jq .{
"status": "success",
"data": [
"__name__",
"api",
"app",
"area",
"branch",
"call",
"code",
"config",
"dialer_name",
"endpoint",
"event",
"exception",
"goversion",
"handler",
"id",
"instance",
"interval",
"job",
"le",
"level",
"listener_name",
"method",
"name",
"outcome",
"quantile",
"reason",
"revision",
"role",
"scrape_job",
"slice",
"state",
"status",
"uri",
"version"
]
}
+ +

List values of label

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
$ curl -sSL http://localhost:9090/api/v1/label/api/values | jq .
{
"status": "success",
"data": [
"afi-nbi",
"afi-sbi",
"bdt-nbi",
"bdt-sbi",
"cp-nbi",
"cp-sbi",
"ee-nbi",
"ee-sbi",
"qos-nbi",
"qos-sbi"
]
}
+ +
1
2
3
4
5
6
7
8
9
10
11
$ curl -sSL http://localhost:9090/api/v1/label/app/values | jq .
{
"status": "success",
"data": [
"afi",
"bdt",
"cp",
"ee",
"qos"
]
}
+ +

Querying metric values

Simple query

Counter

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
$ curl -sSL 'http://localhost:9090/api/v1/query?query=api_north_requests_recv_total' | jq .
{
"status": "success",
"data": {
"resultType": "vector",
"result": [
{
"metric": {
"__name__": "api_north_requests_recv_total",
"api": "afi-nbi",
"app": "afi",
"instance": "localhost:8181",
"job": "simulator-localhost-8181"
},
"value": [
1618031222.5,
"1380800"
]
},
{
"metric": {
"__name__": "api_north_requests_recv_total",
"api": "bdt-nbi",
"app": "bdt",
"instance": "localhost:8181",
"job": "simulator-localhost-8181"
},
"value": [
1618031222.5,
"2071200"
]
},
{
"metric": {
"__name__": "api_north_requests_recv_total",
"api": "cp-nbi",
"app": "cp",
"instance": "localhost:8181",
"job": "simulator-localhost-8181"
},
"value": [
1618031222.5,
"2761600"
]
},
{
"metric": {
"__name__": "api_north_requests_recv_total",
"api": "ee-nbi",
"app": "ee",
"instance": "localhost:8181",
"job": "simulator-localhost-8181"
},
"value": [
1618031222.5,
"11046400"
]
},
{
"metric": {
"__name__": "api_north_requests_recv_total",
"api": "qos-nbi",
"app": "qos",
"instance": "localhost:8181",
"job": "simulator-localhost-8181"
},
"value": [
1618031222.5,
"3452000"
]
},
{
"metric": {
"__name__": "api_north_requests_recv_total",
"instance": "localhost:8181",
"job": "simulator-localhost-8181"
},
"value": [
1618031222.5,
"690400"
]
}
]
}
}
+ +

Gauge

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
$ curl -sSL 'http://localhost:9090/api/v1/query?query=connected_device_gauge' | jq .
{
"status": "success",
"data": {
"resultType": "vector",
"result": [
{
"metric": {
"__name__": "connected_device_gauge",
"api": "afi-sbi",
"app": "afi",
"instance": "localhost:8181",
"job": "simulator-localhost-8181"
},
"value": [
1618031307.066,
"200"
]
},
{
"metric": {
"__name__": "connected_device_gauge",
"api": "bdt-sbi",
"app": "bdt",
"instance": "localhost:8181",
"job": "simulator-localhost-8181"
},
"value": [
1618031307.066,
"300"
]
},
{
"metric": {
"__name__": "connected_device_gauge",
"api": "cp-sbi",
"app": "cp",
"instance": "localhost:8181",
"job": "simulator-localhost-8181"
},
"value": [
1618031307.066,
"400"
]
},
{
"metric": {
"__name__": "connected_device_gauge",
"api": "ee-sbi",
"app": "ee",
"instance": "localhost:8181",
"job": "simulator-localhost-8181"
},
"value": [
1618031307.066,
"1600"
]
},
{
"metric": {
"__name__": "connected_device_gauge",
"api": "qos-sbi",
"app": "qos",
"instance": "localhost:8181",
"job": "simulator-localhost-8181"
},
"value": [
1618031307.066,
"500"
]
},
{
"metric": {
"__name__": "connected_device_gauge",
"instance": "localhost:8181",
"job": "simulator-localhost-8181"
},
"value": [
1618031307.066,
"100"
]
}
]
}
}
+ + +

Query by labels

Query Counter by labels

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# api_north_requests_recv_total{api=~"bdt-nbi|cp-nbi|ee-nbi|qos-nbi|afi-nbi"}
$ curl -sSL 'http://localhost:9090/api/v1/query?query=api_north_requests_recv_total%7Bapi%3D~"bdt-nbi|cp-nbi|ee-nbi|qos-nbi|afi-nbi"%7D' | jq .
{
"status": "success",
"data": {
"resultType": "vector",
"result": [
{
"metric": {
"__name__": "api_north_requests_recv_total",
"api": "afi-nbi",
"app": "afi",
"instance": "localhost:8181",
"job": "simulator-localhost-8181"
},
"value": [
1618031396.263,
"19200"
]
},
{
"metric": {
"__name__": "api_north_requests_recv_total",
"api": "bdt-nbi",
"app": "bdt",
"instance": "localhost:8181",
"job": "simulator-localhost-8181"
},
"value": [
1618031396.263,
"28800"
]
},
{
"metric": {
"__name__": "api_north_requests_recv_total",
"api": "cp-nbi",
"app": "cp",
"instance": "localhost:8181",
"job": "simulator-localhost-8181"
},
"value": [
1618031396.263,
"38400"
]
},
{
"metric": {
"__name__": "api_north_requests_recv_total",
"api": "ee-nbi",
"app": "ee",
"instance": "localhost:8181",
"job": "simulator-localhost-8181"
},
"value": [
1618031396.263,
"153600"
]
},
{
"metric": {
"__name__": "api_north_requests_recv_total",
"api": "qos-nbi",
"app": "qos",
"instance": "localhost:8181",
"job": "simulator-localhost-8181"
},
"value": [
1618031396.263,
"48000"
]
}
]
}
}
+ +

Query Gauge by labels

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# connected_device_gauge{api=~"bdt-sbi|cp-sbi|ee-sbi|qos-sbi|afi-sbi"}
$ curl -sSL 'http://localhost:9090/api/v1/query?query=connected_device_gauge%7Bapi%3D~"bdt-sbi|cp-sbi|ee-sbi|qos-sbi|afi-sbi"%7D' | jq .
{
"status": "success",
"data": {
"resultType": "vector",
"result": [
{
"metric": {
"__name__": "connected_device_gauge",
"api": "afi-sbi",
"app": "afi",
"instance": "localhost:8181",
"job": "simulator-localhost-8181"
},
"value": [
1618031544.665,
"200"
]
},
{
"metric": {
"__name__": "connected_device_gauge",
"api": "bdt-sbi",
"app": "bdt",
"instance": "localhost:8181",
"job": "simulator-localhost-8181"
},
"value": [
1618031544.665,
"300"
]
},
{
"metric": {
"__name__": "connected_device_gauge",
"api": "cp-sbi",
"app": "cp",
"instance": "localhost:8181",
"job": "simulator-localhost-8181"
},
"value": [
1618031544.665,
"400"
]
},
{
"metric": {
"__name__": "connected_device_gauge",
"api": "ee-sbi",
"app": "ee",
"instance": "localhost:8181",
"job": "simulator-localhost-8181"
},
"value": [
1618031544.665,
"1600"
]
},
{
"metric": {
"__name__": "connected_device_gauge",
"api": "qos-sbi",
"app": "qos",
"instance": "localhost:8181",
"job": "simulator-localhost-8181"
},
"value": [
1618031544.665,
"500"
]
}
]
}
}
+ +

Aggregation query

Aggregation of Counter

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# sum(api_north_requests_recv_total{api=~"bdt-nbi|cp-nbi|ee-nbi|qos-nbi|afi-nbi"})
$ curl -sSL 'http://localhost:9090/api/v1/query?query=sum(api_north_requests_recv_total%7Bapi%3D~"bdt-nbi|cp-nbi|ee-nbi|qos-nbi|afi-nbi"%7D)' | jq .
{
"status": "success",
"data": {
"resultType": "vector",
"result": [
{
"metric": {},
"value": [
1618031709.761,
"1188000"
]
}
]
}
}

# sum(api_north_requests_recv_total)
$ curl -sSL 'http://localhost:9090/api/v1/query?query=sum(api_north_requests_recv_total)' | jq .
{
"status": "success",
"data": {
"resultType": "vector",
"result": [
{
"metric": {},
"value": [
1618031709.873,
"1227600"
]
}
]
}
}
+ +

Aggregation of Gauge

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# sum(connected_device_gauge{api=~"bdt-sbi|cp-sbi|ee-sbi|qos-sbi|afi-sbi"})
$ curl -sSL 'http://localhost:9090/api/v1/query?query=sum(connected_device_gauge%7Bapi%3D~"bdt-sbi|cp-sbi|ee-sbi|qos-sbi|afi-sbi"%7D)' | jq .
{
"status": "success",
"data": {
"resultType": "vector",
"result": [
{
"metric": {},
"value": [
1618031937.161,
"3000"
]
}
]
}
}

# sum(connected_device_gauge)
$ curl -sSL 'http://localhost:9090/api/v1/query?query=sum(connected_device_gauge)' | jq .
{
"status": "success",
"data": {
"resultType": "vector",
"result": [
{
"metric": {},
"value": [
1618031937.277,
"3100"
]
}
]
}
}
+ +

Rate query (Counter)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# sum(rate(api_north_requests_recv_total{api=~"bdt-nbi|cp-nbi|ee-nbi|qos-nbi|afi-nbi"}[60s]))
$ curl -sSL 'http://localhost:9090/api/v1/query?query=sum(rate(api_north_requests_recv_total%7Bapi%3D~"bdt-nbi|cp-nbi|ee-nbi|qos-nbi|afi-nbi"%7D%5B60s%5D))' | jq .
{
"status": "success",
"data": {
"resultType": "vector",
"result": [
{
"metric": {},
"value": [
1618032295.164,
"3000.066668148181"
]
}
]
}
}

# sum(rate(api_north_requests_recv_total[60s]))
$ curl -sSL 'http://localhost:9090/api/v1/query?query=sum(rate(api_north_requests_recv_total%5B60s%5D))' | jq .
{
"status": "success",
"data": {
"resultType": "vector",
"result": [
{
"metric": {},
"value": [
1618032295.276,
"3100.0688904197873"
]
}
]
}
}
+ +

Rate subtraction query

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# sum(rate(api_north_requests_recv_total{api="cp-nbi"}[60s])) - sum(rate(api_north_requests_recv_total{api="bdt-nbi"}[60s]))
curl -sSL 'http://localhost:9090/api/v1/query?query=sum%28rate%28api_north_requests_recv_total%7Bapi%3D%22cp-nbi%22%7D%5B60s%5D%29%29%20-%20sum%28rate%28api_north_requests_recv_total%7Bapi%3D%22bdt-nbi%22%7D%5B60s%5D%29%29' | jq .
{
"status": "success",
"data": {
"resultType": "vector",
"result": [
{
"metric": {},
"value": [
1618032478.932,
"99.99555575307767"
]
}
]
}
}
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2021/04/11/benefits-of-learning-haskell/10-reasons-to-use-haskell.png b/2021/04/11/benefits-of-learning-haskell/10-reasons-to-use-haskell.png new file mode 100644 index 00000000..c6383916 Binary files /dev/null and b/2021/04/11/benefits-of-learning-haskell/10-reasons-to-use-haskell.png differ diff --git a/2021/04/11/benefits-of-learning-haskell/haskell-purely-functional.jpg b/2021/04/11/benefits-of-learning-haskell/haskell-purely-functional.jpg new file mode 100644 index 00000000..1a0b265b Binary files /dev/null and b/2021/04/11/benefits-of-learning-haskell/haskell-purely-functional.jpg differ diff --git a/2021/04/11/benefits-of-learning-haskell/index.html b/2021/04/11/benefits-of-learning-haskell/index.html new file mode 100644 index 00000000..1cae956f --- /dev/null +++ b/2021/04/11/benefits-of-learning-haskell/index.html @@ -0,0 +1,247 @@ + + + + + + + + + + + + Benefits of Learning Haskell | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Benefits of Learning Haskell +

+ +

Benefits of Learning Haskell

As developers, there is so much we can learn to improve our skills, ranging from deep theory, to small practical tidbits of information. It can be overwhelming at times and we are forced to pick what we want to learn deeply and what we just want to gloss over. You can’t learn it all!

+

My belief is that in terms of long term improvement, learning Haskell is one of the best ways to up your raw programming ability.

+

Why Learn New Language

Learning a new programming language is a great way to improve as a programmer. Each language has its own unique take on things and will have some great ideas.

+

Usually these new learnings are not strictly tied to the new language. You can take them and use them in many different programming languages.

+

Ok but Why Learn Haskell

When learning a new programming language for improvement, it is usually best to choose some language that is very different from your known programming languages. For example, if you know Ruby you probably wouldn’t get a huge amount out of learning Python, as they are quite similar.

+

Haskell is very different from mainstream popular programming languages. Most developers work in these mainstream languages and so Haskell has a lot to teach them.

+

How is it different?

+

Functional Programming

They don't know I'm an advanced purely functional programming language

+

Haskell is a purely functional programming (FP) language. What is FP? I see it as programming enhanced by ideas and constructs from math.

+
    +
  • Haskell uses FP from the ground up. The whole ecosystem builds on these concepts, so you can’t avoid them.
  • +
  • It is pure. It does not have unconstrained side effects, so you need to learn the FP way of handling them.
  • +
  • Similarly, it is immutable, so you must learn how FP manages this.
  • +
  • It’s implementation closely mirrors the math behind FP, so you are learning something close to the real underlying concepts.
  • +
+

Haskell actually inspired a lot of the FP implementations in more popular languages. Knowing FP in Haskell will make these (typically simpler) implementations easy to understand.

+

Static Type Checking

Haskell builds on type theory and has an advanced type system. This includes ‘type-level’ programming, or code that is run by the compiler at compile time, not at run time.

+

Like how many mainstream languages are getting FP features, they are also getting (more sophisticated) type checkers. Again, if you learn Haskell, these (likely simpler) type systems should be easy to use.

+

For example, Kotlin has sealed classes which support matching. It can be hard to see how these might be useful and I imagine many OO background developers would ignore them.

+

However, these a really just a form of sum types and pattern matching, which are incredibly useful. You can learn the clean implementation in Haskell then apply this knowledge in other languages.

+

You Can Use Haskell in Prod

There are even fancier languages than Haskell. Not more advanced in all ways, but that take a specific idea and go much further than Haskell. However, you can’t easily use these languages in prod. Either because they are too immature, or they aren’t really designed for it.

+

Haskell on the other hand is a sweet spot where it is highly advanced, but you can (and many companies do) use it in prod.

+

This means:

+
    +
  • You can learn Haskell by building real things.
  • +
  • One day you might be able to just use Haskell directly in prod, not do FP in OO languages. 😉
  • +
+

10 Reasons to Use Haskell

10 Reasons to Use Haskell

+
    +
  1. Memory safety. Manual memory management in C and C++ often leads to buffer overflows, use-after-free, memory leaks, and other memory-related bugs. This results in security vulnerabilities. Software written in Haskell is unlikely to exhibit such issues thanks to automatic memory management. Memory safety is a common trait among modern languages, including Java, Python, Go, JavaScript, Rust, and others, and it is absolutely essential for writing secure software.

    +
  2. +
  3. Garbage collection. Garbage collection is less limiting than lifetime checking, thus facilitating better abstractions and higher developer productivity.

    +
  4. +
  5. Native code. This makes Haskell a great choice for applications that require good performance, such as high-throughput data processing.

    +
  6. +
  7. Static types. This means that many bugs are caught early in the development cycle before the product reaches the users or even the quality assurance department. Furthermore, the developer can study the data model encoded in types to better understand the business domain.

    +
  8. +
  9. Rich types. Unlike Java or Go, where static types often come off as a nuisance, the type system of Haskell is powerful enough to become a convenience. With support for algebraic data types, parametric polymorphism, class-based (ad-hoc) polymorphism, type families, type equalities, existential quantification, higher-rank polymorphism, kind polymorphism, runtime type inspection, Haskell offers an extremely versatile toolset for writing statically typed programs.

    +
  10. +
  11. Purity. Haskell’s design is centered around pure functions and immutable data. Over and over, these features have proven essential for writing correct software. Managing global state, mutable data, and side effects is error-prone, and Haskell gives the programmer all the tools to avoid or minimize these sources of complexity.

    +
  12. +
  13. Laziness. From the very start, Haskell was conceived as a lazy language, and to this day lazy evaluation remains its landmark feature. The idea is to defer computation until the results are needed, and the consequences are ease of refactoring, the ability to define custom control structures, and improved composability.

    +
  14. +
  15. Concurrency. In many languages, concurrency is a never-ending source of issues, but in Haskell it is fairly straightforward. Green threads, amazing libraries such as async and stm, and ubiquity of pure functions make writing concurrent applications in Haskell a pleasure instead of a headache.

    +
  16. +
  17. Metaprogramming. Haskell supports the inspection and generation of the program’s abstract syntax tree. This feature is called Template Haskell, and it’s used for compile-time evaluation and to automate boilerplate generation.

    +
  18. +
  19. Ecosystem. Hackage is a centralized repository of open-source Haskell software, featuring over 15000 packages. Stackage is a curated collection of package versions that guarantees compatibility between libraries, featuring over 2500 well-maintained packages. It is not uncommon to find out that the problem you’re solving has already been solved and shipped as an open-source library.

    +
  20. +
+

Learning Haskell

Haskell is awesome, but it is a niche language. You can expect some challenge in getting things set up and of course learning the language. Some describe it as learning to program again from scratch.

+

The key to making the journey manageable is to find some community to support you. The FP slack and Haskell :: Reddit are both excellent choices.

+
    +
  1. Yorgey’s cis194 course
  2. +
  3. Functional Programming course
  4. +
  5. Supplementary course, cs240h Spring 14
  6. +
  7. Supplementary course, cs240h Winter 16
  8. +
+

Above all, I think learning Haskell should be fun. Try and enjoy the ride. 😊

+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2021/04/17/julia-data-types/index.html b/2021/04/17/julia-data-types/index.html new file mode 100644 index 00000000..4bcef011 --- /dev/null +++ b/2021/04/17/julia-data-types/index.html @@ -0,0 +1,337 @@ + + + + + + + + + + + + Julia Data Types | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Julia Data Types +

+ +

Julia Data Types

Integer types

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
TypeSigned?Number of bitsRange
Int88-2^7 ~ 2^7 - 1
UInt880 ~ 2^8 - 1
Int1616-2^15 ~ 2^15 - 1
UInt16160 ~ 2^16 - 1
Int3232-2^31 ~ 2^31 - 1
UInt32320 ~ 2^32 - 1
Int6464-2^63 ~ 2^63 - 1
UInt64640 ~ 2^64 - 1
Int128128-2^127 ~ 2^127 - 1
UInt1281280 ~ 2^128 - 1
BoolN/A8false (0), true (1)
+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
julia> typeof(3000000000)
Int64

julia> (typemin(Int32), typemax(Int32))
(-2147483648, 2147483647)

julia> for T in [Int8, Int16, Int32, Int64, Int128, UInt8, UInt16, UInt32, UInt64, UInt128]
println("$(lpad(T, 8)): [$(typemin(T)), $(typemax(T))]")
end
Int8: [-128, 127]
Int16: [-32768, 32767]
Int32: [-2147483648, 2147483647]
Int64: [-9223372036854775808, 9223372036854775807]
Int128: [-170141183460469231731687303715884105728, 170141183460469231731687303715884105727]
UInt8: [0, 255]
UInt16: [0, 65535]
UInt32: [0, 4294967295]
UInt64: [0, 18446744073709551615]
UInt128: [0, 340282366920938463463374607431768211455]
+ +

Floating-point types

Floating point numbers follow IEEE 754 standard.

+ + + + + + + + + + + + + + + + + + + + + + + +
TypePrecisionNumber of bits
Float16half16
Float32single32
Float64double64
+

Complex number type

The global constant im is bound to the complex number i, representing the principal square root of -1.

+ + + + + + + + + + + + + + + + + + + + + + + +
TypeAliasNumber of bits
Complex{Float16}ComplexF1616
Complex{Float32}ComplexF3232
Complex{Float64}ComplexF6464
+
1
2
3
4
5
6
7
8
9
10
11
julia> 1 + 2im
1 + 2im

julia> (1 + 2im)*(2 - 3im)
8 + 1im

julia> (1 + 2im)/(1 - 2im)
-0.6 + 0.8im

julia> (-1 + 2im)^(1 + 1im)
-0.27910381075826657 + 0.08708053414102428im
+ +

Arbitrary Precision Arithmetic

The BigInt and BigFloat types are available in Julia for arbitrary precision integer and floating point numbers respectively.

+

BigInt

1
2
3
4
5
6
7
8
9
10
11
12
13
14
julia> BigInt(typemax(Int64)) + 1
9223372036854775808

julia> big"123456789012345678901234567890" + 1
123456789012345678901234567891

julia> parse(BigInt, "123456789012345678901234567890") + 1
123456789012345678901234567891

julia> typeof(ans)
BigInt

julia> string(big"2"^200, base=16)
"100000000000000000000000000000000000000000000000000"
+ +

BigFloat

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
julia> big"1.23456789012345678901"
1.234567890123456789010000000000000000000000000000000000000000000000000000000004

julia> typeof(ans)
BigFloat

julia> (big"2")^66/big"3"
2.459565876494606882133333333333333333333333333333333333333333333333333333333344e+19

julia> typeof(ans)
BigFloat

julia> Base.MPFR.precision((big"2")^66/big"3")
256

julia> setprecision(16) do
ans = (big"2")^66/big"3"
println("$(ans): $(Base.MPFR.precision(ans))")
end
2.45958e+19: 16

julia> setprecision(512) do
ans = (big"2")^66/big"3"
println("$(ans): $(Base.MPFR.precision(ans))")
end
2.45956587649460688213333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333343e+19: 512
+ +

Rational Numbers

Julia has a rational number type to represent exact ratios of integers. Rationals are constructed using the // operator:

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
julia> 2//3
2//3

julia> numerator(2//3)
2

julia> denominator(2//3)
3

julia> 2//3 == 6//9
true

julia> 2//3^36
2//150094635296999121

julia> typeof(ans)
Rational{Int64}

julia> big"5"//3
5//3

julia> typeof(ans)
Rational{BigInt}
+ +

Strings

Strings are finite sequences of characters. The built-in concrete type used for strings (and string literals) in Julia is String. This supports the full range of Unicode characters via the UTF-8 encoding.

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
julia> c = 'x'
'x': ASCII/Unicode U+0078 (category Ll: Letter, lowercase)

julia> typeof(c)
Char

julia> Char(120)
'x': ASCII/Unicode U+0078 (category Ll: Letter, lowercase)

julia> Char(0x110000)
'\U110000': Unicode U+110000 (category In: Invalid, too high)

julia> isvalid(Char, 0x110000)
false

julia> isvalid(Char, 0x11000)
true

julia> Char(0x11000)
'𑀀 ': Unicode U+11000 (category Mc: Mark, spacing combining)

julia> '\u2200'
'∀': Unicode U+2200 (category Sm: Symbol, math)

julia> str = "Hello, world.\n"
"Hello, world.\n"

julia> typeof(ans)
String

julia> """Contains "quote" characters"""
"Contains \"quote\" characters"

julia> typeof(ans)
String
+ +

Regular Expressions

Julia has Perl-compatible regular expressions (regexes), as provided by the PCRE library.

+
1
2
3
4
5
julia> re = r"^\s*(?:#|$)"
r"^\s*(?:#|$)"

julia> typeof(re)
Regex
+ +

Byte Array Literals

Another useful non-standard string literal is the byte-array string literal: b”…”. This form lets you use string notation to express read only literal byte arrays – i.e. arrays of UInt8 values. The type of those objects is CodeUnits{UInt8, String}.

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
julia> b"DATA\xff\u2200"
8-element Base.CodeUnits{UInt8, String}:
0x44
0x41
0x54
0x41
0xff
0xe2
0x88
0x80

julia> typeof(ans)
Base.CodeUnits{UInt8, String}

julia> x = b"123"
3-element Base.CodeUnits{UInt8, String}:
0x31
0x32
0x33

julia> Vector{UInt8}(x)
3-element Vector{UInt8}:
0x31
0x32
0x33
+ +

Version Number Literals

Version numbers can easily be expressed with non-standard string literals of the form v”…”.

+
1
2
3
if v"0.2" <= VERSION < v"0.3-"
# do something specific to 0.2 release series
end
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2021/04/18/rest-api-backend-by-julia-with-genie/index.html b/2021/04/18/rest-api-backend-by-julia-with-genie/index.html new file mode 100644 index 00000000..cd30a193 --- /dev/null +++ b/2021/04/18/rest-api-backend-by-julia-with-genie/index.html @@ -0,0 +1,210 @@ + + + + + + + + + + + + REST API backend by Julia with Genie | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ REST API backend by Julia with Genie +

+ +

REST API backend by Julia with Genie

Introduction

Julia language

Put the motto to rest.

+
+

Julia Walks like Python, Runs like C.

+
+

Julia is a rather new and ground-breaking programming language that was released in early stages back in 2012. In that short span of time between then and 2020, the size of the ecosystem and the build of the language has absolutely exploded. Just looking at the popularity based on Github stars and Insights of the programming language, it is easy to see just how much the language has accomplished in just the past few years.

+

Julia’s success has ultimately correlated with the rapid machine-learning growth that the scientific ecosystem has experienced in general.

+

Genie web framework

Genie is a full-stack MVC web framework that provides a streamlined and efficient workflow for developing modern web applications. It builds on Julia’s strengths (high-level, high-performance, dynamic, JIT compiled), exposing a rich API and a powerful toolset for productive web development.

+

How to Install Genie

By interactive environment

1
julia> import Pkg; Pkg.add("Genie")
+ +

By Pkg REPL - from Julia’s registry

1
pkg> add Genie
+ +

By Pkg REPL - by running off the master branch

1
pkg> add Genie#master
+ +

Developing Genie Web Services

REST API backend - coding

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
using Genie, Genie.Router, Genie.Renderer.Json, Genie.Requests
using HTTP

route("/") do
"Welcome to Genie!" |> json
end

route("/foo") do
json(:foo => "Foo")
end

route("/sum/:x::Int/:y::Int") do
params(:x) + params(:y) |> json
end

Genie.startup(port = 8080, async = false)
+ +

REST API backend - running

1
2
3
julia rest-demo.jl
┌ Info:
└ Web Server starting at http://127.0.0.1:8080 - press Ctrl/Cmd+C to stop the server.
+ +

REST API client

1
2
3
4
5
6
7
8
$ curl -isS --http2 http://127.0.0.1:8080/

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Server: Genie/Julia/1.5.4
Transfer-Encoding: chunked

"Welcome to Genie!"
+ +
1
2
3
4
5
6
7
$ curl -isS --http2 http://127.0.0.1:8080/foo
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Server: Genie/Julia/1.5.4
Transfer-Encoding: chunked

{"foo":"Foo"}
+ +
1
2
3
4
5
6
7
$ curl -isS --http2 http://127.0.0.1:8080/sum/3/8
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Server: Genie/Julia/1.5.4
Transfer-Encoding: chunked

11
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2021/04/24/openmp-5-1-with-vital-usability-enhancements/index.html b/2021/04/24/openmp-5-1-with-vital-usability-enhancements/index.html new file mode 100644 index 00000000..954d69a7 --- /dev/null +++ b/2021/04/24/openmp-5-1-with-vital-usability-enhancements/index.html @@ -0,0 +1,252 @@ + + + + + + + + + + + + OpenMP 5.1 with Vital Usability Enhancements | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ OpenMP 5.1 with Vital Usability Enhancements +

+ +

OpenMP 5.1 with Vital Usability Enhancements

About OpenMP

The mission of the OpenMP Architecture Review Board (ARB) is to standardize directive-based multi-language high-level parallelism that is performant, productive and portable. Jointly defined by a group of major computer hardware and software vendors, and users, the OpenMP API is a portable, scalable model that gives parallel programmers a simple and flexible interface for developing parallel applications for platforms ranging from embedded systems and accelerator devices to multicore systems and shared-memory systems. The OpenMP ARB owns the OpenMP brand, oversees the OpenMP specification and produces and approves new versions of the specification.

+

OpenMP 5.1 introduction

The OpenMP® Architecture Review Board (ARB) has released Version 5.1 of the OpenMP API. With this release of the standard, OpenMP strengthens its handling of accelerator devices, allows improved optimization and supports the latest versions of C, C++ and Fortran.

+
+

OpenMP 5.1 represents the culmination of the past two years of work within the OpenMP Language Committee,” said Bronis R. de Supinski, the LC Chair. “While the primary focus has been enhancements, clarifications and corrections to the 5.0 specification, we have added several useful new features, such as support for interoperability with lower level APIs like CUDA and HIP.

+
+

New Features

Version 5.1 of the OpenMP specification was jointly developed by the OpenMP ARB, a group of major computer hardware and software vendors, as well as users throughout the OpenMP community. The updated specification includes the following key additions:

+
    +
  • Improvements in accelerator device interactions:
      +
    • The interop construct, which enables interoperability with non-OpenMP device execution contexts, provides support for interactions with native device interfaces (e.g., for CUDA streams, HIP or OpenCL);
    • +
    • Function pointers can now be mapped to a device or accelerator; and
    • +
    • Device-specific environment variables have been added.
    • +
    +
  • +
  • Providing more information to the compiler to allow improved optimization:
      +
    • The assume directive gives the implementation additional information about the way a program uses OpenMP, which allows additional optimizations to be safely applied by compilers, or safe OpenMP subsets to be implemented; and
    • +
    • Loop transformation directives have been introduced, starting with the tile directive, which can improve data locality, and the unroll directive, which fully or partially unrolls a loop.
    • +
    +
  • +
  • Filtering of execution by thread
      +
    • The masked directive can restrict execution of a code region to a subset of the threads.
    • +
    +
  • +
  • Allowing the user to generate compile-time errors and warnings:
      +
    • A new error directive has been added.
    • +
    +
  • +
  • Improvements in modern C++ usage of OpenMP:
      +
    • Instead of the traditional pragma form, C++ attribute syntax can be used to specify OpenMP directives, which simplifies their integration with templates; and
    • +
    • Full support for C11, C18, C++11, C++14, C++17 and C++20: Programs written in these languages can now be parallelized with OpenMP.
    • +
    +
  • +
  • Improvements in the support for Fortran:
      +
    • Fortran 2008 is now fully supported and initial support for Fortran 2018 has been added.
    • +
    +
  • +
  • Easier declaration of environment-specific functions:
      +
    • Multiple functions can now be included in a single declare variant construct, and code can be more closely tailored to a specific environment.
    • +
    +
  • +
+

Implementations

Major vendors and open source compilers have implemented parts of the OpenMP 5 specification in their products. LLVM, GCC, AMD, Intel, HPE, NVIDIA, Mentor Graphics to name just a few. In addition, debugging and performance tools are being extended with OpenMP 5 features.

+

Demo code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/*
* gcc -O2 -mavx2 -std=c11 -fopenmp openmp-demo.c -lgomp -o openmp-demo
* cl /O2 /arch:AVX2 /std:c11 /openmp openmp-demo.c
*/

#include <omp.h>
#include <stdio.h>
#include <stdlib.h>

int main()
{
int tid;

/* Fork a team of threads giving them their own copies of variables */
#pragma omp parallel private(tid)
{
/* Obtain thread number */
tid = omp_get_thread_num();
printf("Hello World from thread = %d\n", tid);

/* Only master thread does this */
if (tid == 0) {
printf("Number of threads = %d\n", omp_get_num_threads());
}

} /* All threads join master thread and disband */

return 0;
}
+ +
1
2
3
4
5
6
7
8
9
10
$ ./openmp-demo
Hello World from thread = 0
Number of threads = 8
Hello World from thread = 2
Hello World from thread = 5
Hello World from thread = 7
Hello World from thread = 1
Hello World from thread = 3
Hello World from thread = 4
Hello World from thread = 6
+ +
1
2
3
4
5
6
7
8
9
10
C:\>.\openmp-demo
Hello World from thread = 1
Hello World from thread = 0
Number of threads = 8
Hello World from thread = 6
Hello World from thread = 4
Hello World from thread = 2
Hello World from thread = 3
Hello World from thread = 7
Hello World from thread = 5
+ +

Reference

+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2021/08/01/getting-the-git-timing-right/index.html b/2021/08/01/getting-the-git-timing-right/index.html new file mode 100644 index 00000000..94cbbfae --- /dev/null +++ b/2021/08/01/getting-the-git-timing-right/index.html @@ -0,0 +1,201 @@ + + + + + + + + + + + + Getting the Git Timing Right | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Getting the Git Timing Right +

+ +

Getting the Git Timing Right

Introduction

Do you work on a development team that is distributed across several time zones? Got confused by the dates that Git shows in the commit logs?

+

Commit timestamps

Let’s assume that two developers work in the same Git repository. The first developer Prasad is located in Bangalore, India. His colleague Joe is located in San Diego, US. The Git log they created looks as follows:

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
$ git log
commit 42eae2e49371be294911ad094d9644d2f58059fc (HEAD -> main)
Author: Joe Smith <jsmith@sandiego.us>
Date: 2016-12-06 11:41:44 -0800

Commit 3

commit 6d8ee6115eaa5ce17b4217d4fedb7a98eb999a1c
Author: Prasad Gupta <pgupta@bangalore.in>
Date: 2016-12-06 21:45:51 +0530

Commit 2

commit 7c9ae27bdb381e73010a0744fd10e979094810ef
Author: Prasad Gupta <pgupta@bangalore.in>
Date: 2016-12-06 21:45:00 +0530

Commit 1
+ +

What might look a little bit odd is the order of the commits in the logs, since they are in the different time zones.

+

Use iso-local date format

git log with parameter date

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
$ git log --date=iso-local
commit 42eae2e49371be294911ad094d9644d2f58059fc (HEAD -> main)
Author: Joe Smith <jsmith@sandiego.us>
Date: 2016-12-07 03:41:44 +0800

Commit 3

commit 6d8ee6115eaa5ce17b4217d4fedb7a98eb999a1c
Author: Prasad Gupta <pgupta@bangalore.in>
Date: 2016-12-07 00:15:51 +0800

Commit 2

commit 7c9ae27bdb381e73010a0744fd10e979094810ef
Author: Prasad Gupta <pgupta@bangalore.in>
Date: 2016-12-07 00:15:00 +0800

Commit 1
+ +

Set log parameter date with git config

1
2
3
4
$ git config --global --get log.date
$ git config --global --add log.date iso-local
$ git config --global --get log.date
iso-local
+ +

Commit with a UTC Timestamp

If you find it rather unnecessary to include your local timezone in your commits, and would like to commit in UTC time for example, you have two options.

+

Changing your timezone before doing a commit

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
$ date; TZ=Tunis date
Tue Aug 1 12:17:30 CST 2021
Tue Aug 1 04:17:30 Tunis 2021

$ date >> 1
$ TZ=Tunis git commit -avm "demo commit"
[main 931d268] demo commit

$ date >> 1
$ git commit -avm "demo commit 2"
[main 616fa14] demo commit 2
1 file changed, 1 insertion(+)

$ git log --date=iso
commit 616fa1499ebf757831e7476bf8af8d9d7bb282f5 (HEAD -> main)
Author: Joe Smith <jsmith@sandiego.us>
Date: 2021-08-01 12:19:41 +0800

demo commit 2

commit 931d268aba2f8fb190ddff01586b189d178f2bd3
Author: Joe Smith <jsmith@sandiego.us>
Date: 2021-08-01 04:19:18 +0000

demo commit
+ +

Using the parameter date to override the date in the commit

1
2
3
4
5
6
7
8
9
10
11
12
13

$ date >> 1
$ git commit --date="$(date --utc +%Y-%m-%dT%H:%M:%S%z)" -avm "demo commit 3"
[main f5a45b0] demo commit 3
Date: Tue Aug 1 04:24:23 2021 +0000
1 file changed, 1 insertion(+)

$ git log -1 --date=iso
commit f5a45b0f74bb2ab29057a7ab62e2f3cff66c46dd (HEAD -> main)
Author: Joe Smith <jsmith@sandiego.us>
Date: 2021-08-01 04:24:23 +0000

demo commit 3
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2021/08/07/visualization-with-matplotlib/index.html b/2021/08/07/visualization-with-matplotlib/index.html new file mode 100644 index 00000000..f8d2e1cc --- /dev/null +++ b/2021/08/07/visualization-with-matplotlib/index.html @@ -0,0 +1,242 @@ + + + + + + + + + + + + Visualization with Matplotlib | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Visualization with Matplotlib +

+ +

Visualization with Matplotlib

Introduction

Matplotlib is a comprehensive library for creating static, animated, and interactive visualizations in Python.

+

Matplotlib makes easy things easy and hard things possible.

+
    +
  • Create
      +
    • Develop publication quality plots with just a few lines of code
    • +
    • Use interactive figures that can zoom, pan, update…
    • +
    +
  • +
  • Customize
      +
    • Take full control of line styles, font properties, axes properties…
    • +
    • Export and embed to a number of file formats and interactive environments
    • +
    +
  • +
  • Extend
      +
    • Explore tailored functionality provided by third party packages
    • +
    • Learn more about Matplotlib through the many external learning resources
    • +
    +
  • +
+

Installation

1
$ pip install -U Matplotlib pandas pycairo scipy wxPython
+ +

Plotting

1
2
3
4
5
6
7
8
9
10
11
12
import matplotlib.pyplot as plt
import numpy as np

x = np.linspace(0, 10, 100)

plt.plot(x, np.sin(x))
plt.plot(x, np.cos(x))

# fig.tight_layout()

plt.tight_layout()
plt.show()
+ +

Saving Figures to File

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# rsvg-convert -d 300 -p 300 -f pdf -a --keep-image-data -o my_figure_3.pdf my_figure.svg
import matplotlib as mpl
mpl.use('wxAgg')

import matplotlib.pyplot as plt
import numpy as np

x = np.linspace(0, 10, 100)

plt.plot(x, np.sin(x))
plt.plot(x, np.cos(x))
plt.tight_layout()
plt.savefig('my_figure.png')
plt.savefig('my_figure.svg')
plt.savefig('my_figure.pdf')
+ +

Matplotlib Backends

Matplotlib is a plotting library. It relies on some backend to actually render the plots.

+

If you omit the default backend parameter, the first working backend from the following list is used:

+
1
MacOSX Qt5Agg Gtk3Agg TkAgg WxAgg Agg
+ +

To get backends that are interactive or integrate into your operating system GUI, you need to know what OS you’re running and what kind of backends have been compiled into your matplotlib library.

+

There’s no easy way to find out what backends are available to be used, instead you can only really find out either by trial and error, or if you have access to the compilation logs.

+

However you can find out what backend the matplotlib library is currently set to and you can find out the string keys that point to different backends.

+

This will show you what the default backend of matplotlib has been set to. If you don’t have any confounding environment variables nor a matplotlibrc file.

+
1
2
3
4
5
6
7
import matplotlib.pyplot as plt
print(plt.get_backend())

TkAgg

import matplotlib as mpl
print(mpl.matplotlib_fname())
+ +

The list of backend string keys can be acquired with:

+
1
2
3
4
5
6
7
8
9
10
11
import matplotlib.rcsetup as rcsetup

print(rcsetup.interactive_bk)
print(rcsetup.non_interactive_bk)
print(rcsetup.all_backends)

['GTK3Agg', 'GTK3Cairo', 'MacOSX', 'nbAgg', 'Qt4Agg', 'Qt4Cairo', 'Qt5Agg', 'Qt5Cairo', 'TkAgg', 'TkCairo', 'WebAgg', 'WX', 'WXAgg', 'WXCairo']

['agg', 'cairo', 'pdf', 'pgf', 'ps', 'svg', 'template']

['GTK3Agg', 'GTK3Cairo', 'MacOSX', 'nbAgg', 'Qt4Agg', 'Qt4Cairo', 'Qt5Agg', 'Qt5Cairo', 'TkAgg', 'TkCairo', 'WebAgg', 'WX', 'WXAgg', 'WXCairo', 'agg', 'cairo', 'pdf', 'pgf', 'ps', 'svg', 'template']
+ +

You can then try to switch to it. These are the ways to do this:

+

The first is to use it just before importing pyplot.

+
1
2
3
4
5
6
7
8
import matplotlib as mpl
mpl.use('wxAgg')
import matplotlib.pyplot as plt

plt.plot(range(20), range(20))
plt.tight_layout()
plt.savefig('linear.png')
plt.show()
+ +

The best way is to use an environment variable:

+
1
MPLBACKEND=Qt4Agg python -c 'import matplotlib.pyplot as plt; print(plt.get_backend())'
+ +

Improve the resolution

Change the dpi settings

1
2
3
4
5
6
7
8
9
import matplotlib as mpl
import matplotlib.pyplot as plt

# figure.dpi: 100.0, savefig.dpi: figure
print("figure.dpi: {}, savefig.dpi: {}".format(plt.rcParams['figure.dpi'], plt.rcParams['savefig.dpi']))

plt.rcParams['figure.dpi'] = 300
# figure.dpi: 300.0, savefig.dpi: figure
print("figure.dpi: {}, savefig.dpi: {}".format(plt.rcParams['figure.dpi'], plt.rcParams['savefig.dpi']))
+ +

Change the image format to a vector format

1
2
3
4
5
6
7
8
9
import matplotlib as mpl
import matplotlib.pyplot as plt

# savefig.format: png
print("savefig.format: {}".format(plt.rcParams['savefig.format']))

plt.rcParams['savefig.format'] = 'svg'
# savefig.format: svg
print("savefig.format: {}".format(plt.rcParams['savefig.format']))
+ +

Reference

+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2021/08/08/sctp-over-udp-in-the-linux-kernel/index.html b/2021/08/08/sctp-over-udp-in-the-linux-kernel/index.html new file mode 100644 index 00000000..04508ff5 --- /dev/null +++ b/2021/08/08/sctp-over-udp-in-the-linux-kernel/index.html @@ -0,0 +1,233 @@ + + + + + + + + + + + + SCTP over UDP in the Linux kernel | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ SCTP over UDP in the Linux kernel +

+ +

SCTP over UDP in the Linux kernel

Introduction

Stream Control Transmission Protocol over User Datagram Protocol (SCTP over UDP, also known as UDP encapsulation of SCTP) is a feature defined in RFC6951 and implemented in the Linux kernel space since 5.11.

+

Why we need SCTP over UDP

As the author said:

+
+

The Main Reasons:

+
    +
  1. To allow SCTP traffic to pass through legacy NATs, which do not +provide native SCTP support as specified in [BEHAVE] and +[NATSUPP].

    +
  2. +
  3. To allow SCTP to be implemented on hosts that do not provide +direct access to the IP layer. In particular, applications can +use their own SCTP implementation if the operating system does not +provide one.

    +
  4. +
+
+

The first reason will solve the middlebox issues that have brought many troubles to users and prevented SCTP’s wide use. The second reason is to allow user space applications to develop their own SCTP implementation based on the UDP protocol.

+

How SCTP over UDP works

With this feature enabled, all SCTP packets are encapsulated into UDP packets. SCTP over UDP is implemented with kernel UDP tunnel APIs that have previously been used by the VXLAN, GENEVE, and TIPC protocols.

+

UDP-encapsulated SCTP is normally communicated between SCTP stacks using the IANA-assigned UDP port number 9899 (sctp-tunneling) on both ends.

+

There are circumstances where other ports may be used on either end, and it might be required to use ports other than the registered port, implementations need to allow other port numbers to be specified as a local or remote UDP encapsulation port number through APIs.

+

How to use SCTP over UDP

When programming, you don’t need to do anything different: All the standard SCTP features still apply, and all the APIs are available to use as before. Old applications will work well without any changes or recompilation. The only adjustment is to set up a UDP port (a local listening port or src port) and an encapsulation port (a remote listening or dest port), which could be done globally for the network namespace by sysctl:

+
1
2
# sysctl -w net.sctp.encap_port=9899
# sysctl -w net.sctp.udp_port=9899
+ +

Alternatively, you could set the encapsulation port per socket, association, or transport, using sockopt:

+
1
setsockopt(SCTP_REMOTE_UDP_ENCAPS_PORT, port);
+ +

On the server side, the encapsulation port normally doesn’t need to be set explicitly, as detailed in the next section.

+

The UDP encapsulation port

The UDP encapsulation port allows for very flexible usage. On the sender side, the global encapsulation port only provides a default value:

+
    +
  • The per-socket encapsulation port can be used when another socket on one host connects to a different host on which a different UDP port is used.
  • +
  • The per-association encapsulation port can be used when the same socket connects to a different host on which a different UDP port is used.
  • +
  • The per-transport encapsulation port can be used when the same association wants to send UDP-encapsulated SCTP packets on one transport.
  • +
+

On the receiver side, the encapsulation port normally doesn’t need to be set:

+
    +
  • The encapsulation port of one association would be learned from the first INIT packet. Other INITs with different UDP src ports would then be discarded.
  • +
  • The encapsulation port of each transport would be learned from the incoming packets on the corresponding path, and can be updated anytime.
  • +
  • Plain SCTP packets can still be processed even if the encapsulation ports of the association and its transports are set.
  • +
+

Conclusion

If you’re using SCTP and enjoying its features, like multi-homing, multi-streaming, and partial-reliability, but having issues with middleboxes, the Linux kernel now provides an easier way to get around them.

+

Reference

+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2021/08/14/hikaricp-and-postgresql/index.html b/2021/08/14/hikaricp-and-postgresql/index.html new file mode 100644 index 00000000..5100ad55 --- /dev/null +++ b/2021/08/14/hikaricp-and-postgresql/index.html @@ -0,0 +1,227 @@ + + + + + + + + + + + + HikariCP and PostgreSQL | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ HikariCP and PostgreSQL +

+ +

HikariCP and PostgreSQL

Introduction

HikariCP is a simple, solid, high-performance, “zero-overhead” production ready JDBC connection pool at last. At roughly 130Kb, the library is very light.

+

Artifacts

Java 11

1
2
3
4
5
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>5.0.0</version>
</dependency>
+ +

Java 8

1
2
3
4
5
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>4.0.3</version>
</dependency>
+ +

About Pool Sizing

Configuring a connection pool is something that developers often get wrong. There are several, possibly counter-intuitive for some, principles that need to be understood when configuring the pool.

+

When we look at what the major bottlenecks for a database are, they can be summarized as three basic categories: CPU, Disk, Network. We could add Memory in there, but compared to Disk and Network there are several orders of magnitude difference in bandwidth.

+

Don’t over-provision your database. The formula below is provided by the PostgreSQL project as a starting point, but I believe it will be largely applicable across databases. You should test your application, i.e. simulate expected load, and try different pool settings around this starting point:

+
1
connections = ((core_count * 2) + effective_spindle_count)
+ +

Don’t be tricked into thinking, “SSDs are faster and therefore I can have more threads”. That is exactly 180 degrees backwards. Faster, no seeks, no rotational delays means less blocking and therefore fewer threads [closer to core count] will perform better than more threads. More threads only perform better when blocking creates opportunities for executing.

+

Production Ready Configuration

1
2
3
4
5
6
7
8
9
10
11
12
13
<property name="hibernate.hikari.jdbcUrl" value="<jdbcUrl>" />
<property name="hibernate.hikari.username" value="<username>" />
<property name="hibernate.hikari.password" value="<password>" />
<property name="hibernate.hikari.autoCommit" value="true" />
<property name="hibernate.hikari.minimumIdle" value="10" />
<property name="hibernate.hikari.maximumPoolSize" value="25" />
<property name="hibernate.hikari.keepaliveTime" value="60000" />
<property name="hibernate.hikari.idleTimeout" value="120000" />
<property name="hibernate.hikari.leakDetectionThreshold" value="150000" />
<property name="hibernate.hikari.maxLifeTime" value="180000" />
<property name="hibernate.hikari.connectionTimeout" value="3000" />
<property name="hibernate.hikari.validationTimeout" value="2500" />
<property name="hibernate.hikari.registerMbeans" value="true" />
+ +

Workaround for Missing Configurations

If missing the following configuration items:

+
1
2
3
4
<property name="hibernate.hikari.keepaliveTime" value="60000" />
<property name="hibernate.hikari.idleTimeout" value="120000" />
<property name="hibernate.hikari.leakDetectionThreshold" value="150000" />
<property name="hibernate.hikari.maxLifeTime" value="180000" />
+ +

We can workaround it by tunning in the PostgreSQL server side:

+
1
2
3
4
5
6
alter system set tcp_keepalives_idle=10;
alter system set tcp_keepalives_interval=2;
alter system set tcp_keepalives_count=3;
alter system set idle_in_transaction_session_timeout='10s';

SELECT pg_reload_conf();
+ +

In sessions connected via a Unix-domain socket, TCP keep-alive parameters are ignored and always reads as zero.

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
$ psql postgres

postgres=# show tcp_keepalives_idle;
tcp_keepalives_idle
---------------------
0
(1 row)

postgres=# show tcp_keepalives_interval;
tcp_keepalives_interval
-------------------------
0
(1 row)

postgres=# show tcp_keepalives_count;
tcp_keepalives_count
----------------------
0
(1 row)

postgres=# show idle_in_transaction_session_timeout;
idle_in_transaction_session_timeout
-------------------------------------
0
(1 row)

postgres=# alter system set tcp_keepalives_idle=10;
ALTER SYSTEM
postgres=# alter system set tcp_keepalives_interval=2;
ALTER SYSTEM
postgres=# alter system set tcp_keepalives_count=3;
ALTER SYSTEM
postgres=# alter system set idle_in_transaction_session_timeout='10s';
ALTER SYSTEM
postgres=#
postgres=# SELECT pg_reload_conf();
pg_reload_conf
----------------
t
(1 row)

postgres=# show idle_in_transaction_session_timeout;
idle_in_transaction_session_timeout
-------------------------------------
10s
(1 row)

postgres=# show tcp_keepalives_count;
tcp_keepalives_count
----------------------
0
(1 row)

postgres=# show tcp_keepalives_interval;
tcp_keepalives_interval
-------------------------
0
(1 row)

postgres=# show tcp_keepalives_idle;
tcp_keepalives_idle
---------------------
0
(1 row)
+ +

Let’s check these parameters with TCP connection:

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
$ psql --host=127.0.0.1

postgres=# show tcp_keepalives_idle;
tcp_keepalives_idle
---------------------
10
(1 row)

postgres=# show tcp_keepalives_interval;
tcp_keepalives_interval
-------------------------
2
(1 row)

postgres=# show tcp_keepalives_count;
tcp_keepalives_count
----------------------
3
(1 row)

postgres=# show idle_in_transaction_session_timeout;
idle_in_transaction_session_timeout
-------------------------------------
10s
(1 row)
+ +

Get Rid of Staled Connections

1
2
3
4
5
6
7
8
9
10
11
12
13
select clock_timestamp(), datname, pid, state, application_name, state_change from pg_stat_activity;

SELECT pg_terminate_backend(pid)
FROM pg_stat_activity
WHERE datname = 'regress'
AND pid <> pg_backend_pid()
AND state in ('idle', 'idle in transaction', 'idle in transaction (aborted)', 'disabled')
AND application_name !~ '(?:psql)|(?:pgAdmin.+)'
AND state_change < current_timestamp - INTERVAL '5' MINUTE;

select statement_timestamp(), datname, pid, state, application_name, state_change from pg_stat_activity;

select clock_timestamp(), datname, pid, state, application_name, state_change from pg_stat_activity;
+ +

Reference

+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2021/08/15/spring-native-what-why-and-how/index.html b/2021/08/15/spring-native-what-why-and-how/index.html new file mode 100644 index 00000000..20485cb6 --- /dev/null +++ b/2021/08/15/spring-native-what-why-and-how/index.html @@ -0,0 +1,268 @@ + + + + + + + + + + + + Spring Native: What, Why and How | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Spring Native: What, Why and How +

+ +

Spring Native: What, Why and How

Introduction

Spring Native makes sure we can compile Spring applications to a native executable. To get these native executables Spring Native uses the GraalVM Native Image compiler.

+

Compared to the Java Virtual Machine, native images can enable cheaper and more sustainable hosting for many types of workloads. These include microservices, function workloads, well suited to containers, and Kubernetes.

+

Using native image provides key advantages, such as instant startup, instant peak performance, and reduced memory consumption.

+

There are also some drawbacks and trade-offs that the GraalVM native project expect to improve on over time. Building a native image is a heavy process that is slower than a regular application. A native image has fewer runtime optimizations after warmup. Finally, it is less mature than the JVM with some different behaviors.

+

The key differences between a regular JVM and this native image platform are:

+
    +
  • A static analysis of your application from the main entry point is performed at build time.
  • +
  • The unused parts are removed at build time.
  • +
  • Configuration is required for reflection, resources, and dynamic proxies.
  • +
  • Classpath is fixed at build time.
  • +
  • No class lazy loading: everything shipped in the executables will be loaded in memory on startup.
  • +
  • Some code will run at build time.
  • +
  • There are some limitations around some aspects of Java applications that are not fully supported.
  • +
+

What are GraalVM Native Images

Native Image is a technology to ahead-of-time compile (AOT) Java code to a standalone executable, called a native image. This executable includes the application classes, classes from its dependencies, runtime library classes, and statically linked native code from JDK.

+

What is Spring Native

Like stated in the intro of this article, Spring Native is a set of tools and frameworks to make the Spring framework compatible with GraalVM Native Images.

+

Advantages for native images

Here are some few advantages of native images:

+

Faster startup

A native image will startup faster, but why can it start faster?

+
    +
  • No class loading: All classes will already we loaded and even partially initiated during build time. This is made possible with the AOT compiler.
  • +
  • No interpreted code: We don’t have to initialize an interpreter and interpret byte-code
  • +
  • No JIT: We don’t have to spend any CPU resources to start a JIT compiler or use a JIT compiler
  • +
  • Generating Image Heap during build: Because we can already partially initiate classes at build time, we can also run some initialization processes at build time. So when we startup we don’t have to execute that part anymore
  • +
+

Lower memory usage

The native image will have less memory usage which makes is more suitable for Docker Images, just to give an example. How does a native image archive this?

+
    +
  • No metadata for loaded classes
  • +
  • No profiling data for JIT
  • +
  • No Interpreter code
  • +
+

Disadvantages for native images

That all sounds good and way better than normal JVM applications. But there are of course also prices to pay when using native images.

+

No Java agents, JMX, JVMTI, Java Flight Recorder support

Some of these features are really handy to manage, test and control your JVM applications. Because the native images does not live in a JVM container these features are not available.

+

Reflection requires extra config

Reflection is widely used in a lot of frameworks so those frameworks need to do extra configuration and work to support native images. That is why Spring created the Spring Native project.

+

No dumps

You will not be able to able to use thread and heap dumps. There are ways to fetch some information about threads by using Linux Kernel features.

+

Limited Logging

+

When do we best to use Spring Native

Spring Native images is the best suited when you are building CLI tools or create some serverless functions. This all has to do with the short live span of the application and the faster startup time. Spring Cloud Functions fit really good with native images.

+

Building an example Native Image

The easiest way to start with Spring Native is probably to go to Spring Initializer Site, add the dependencies Spring Reactive Web and Spring Native [Experimental], and read the reference documentation. Make sure to configure properly the Spring AOT Maven and Gradle plugins that are mandatory to get proper native support for your Spring application.

+

Make sure the following are installed: Java 11, Maven/Gradle, Docker, and GraalVM native-image compiler.

+

Update pom.xml

Add Spring Native [Experimental] dependency to the pom.xml:

+
1
2
3
4
5
<dependency>
<groupId>org.springframework.experimental</groupId>
<artifactId>spring-native</artifactId>
<version>${spring-native.version}</version>
</dependency>
+ +

Add spring-aot-maven-plugin to the pom.xml:

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<plugin>
<groupId>org.springframework.experimental</groupId>
<artifactId>spring-aot-maven-plugin</artifactId>
<version>${spring-native.version}</version>
<executions>
<execution>
<id>test-generate</id>
<goals>
<goal>test-generate</goal>
</goals>
</execution>
<execution>
<id>generate</id>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
+ +

This plugin is used to compile your Spring application code to make it ready for native execution. This plugin will also add all the configuration that is needed to handle the Reflection that Spring uses.

+

Spring AOT

Spring AOT (Ahead-of-Time) aims at improving compatibility and footprint of native images for Spring Native applications. To achieve that, this projects ships Maven and Gradle build plugins that generate and compile a separate set of Java sources to be packaged with your Spring Boot application. By looking at your application classpath and configuration, Spring AOT brings some of the configuration processing at build time and streamlines the native image compilation process.

+

Maven goals spring-aot:generate (process-test-classes phase) and spring-aot:test-generate (prepare-package phase) are automatically invoked in the Maven lifecycle when using the mvn verify or mvn package commands.

+
1
2
$ mvn -D skipTests=true package spring-aot:generate
Total time: 01:25 min
+ +

Add endpoint

1
2
3
4
5
6
@Bean
public RouterFunction<ServerResponse> routes() {
return RouterFunctions.route()
.GET("/", request -> ServerResponse.ok().body(Mono.just("Hello World!\n"), String.class))
.build();
}
+ +

Verification Endpoint

1
2
3
4
5
6
# mvn spring-boot:run
Started SpringBootNativeApplication in 6.65 seconds (JVM running for 7.325)

# curl -iSS http://localhost:8080
# curl -iSS --http2 http://localhost:8080
# curl -iSS --http2-prior-knowledge http://localhost:8080
+ +

Building the image

Now we need to use maven to build the docker image. Spring boot already has support to build docker images with it’s plugin.

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
$ java -version
java version "11.0.12" 2021-07-20 LTS
Java(TM) SE Runtime Environment GraalVM EE 21.2.0 (build 11.0.12+8-LTS-jvmci-21.2-b06)
Java HotSpot(TM) 64-Bit Server VM GraalVM EE 21.2.0 (build 11.0.12+8-LTS-jvmci-21.2-b06, mixed mode, sharing)

$ gradle tasks

$ gradle bootBuildImage -x test
Successfully built image 'docker.io/library/spring-boot-native:0.0.1-SNAPSHOT'
BUILD SUCCESSFUL in 8m 5s

# docker images

# docker run --rm --name spring-native-example -p 8080:8080 docker.io/library/spring-boot-native:0.0.1-SNAPSHOT
+ +
1
2
3
4
5
6
7
$ mvn -U -D skipTests=true package spring-boot:build-image
Successfully built image 'docker.io/library/spring-boot-native:0.0.1-SNAPSHOT'
Total time: 06:43 min

# docker images

# docker run --rm --name spring-native-example -p 8080:8080 docker.io/library/spring-boot-native:0.0.1-SNAPSHOT
+ +

Verification Native Image

1
2
3
4
5
6
$ curl -iSS http://localhost:8080
HTTP/1.1 200 OK
Content-Type: text/plain;charset=UTF-8
Content-Length: 13

Hello World!
+ +
1
2
3
4
5
6
7
8
9
10
$ curl -iSS --http2 http://localhost:8080
HTTP/1.1 101 Switching Protocols
connection: upgrade
upgrade: h2c

HTTP/2 200
content-type: text/plain;charset=UTF-8
content-length: 13

Hello World!
+ +
1
2
3
4
5
6
$ curl -iSS --http2-prior-knowledge http://localhost:8080
HTTP/2 200
content-type: text/plain;charset=UTF-8
content-length: 13

Hello World!
+ +

Conclusion

We went a bit over the theory what native images are and how Spring Native fits into the equation. The example application shows that the native image boots up way faster. Currently Spring Native is still experimental and in beta, but it looks real promising for serverless architectures.

+

Reference

+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2021/09/04/windows-server-2022-generally-available/index.html b/2021/09/04/windows-server-2022-generally-available/index.html new file mode 100644 index 00000000..84a5ff66 --- /dev/null +++ b/2021/09/04/windows-server-2022-generally-available/index.html @@ -0,0 +1,231 @@ + + + + + + + + + + + + Windows Server 2022 generally available | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Windows Server 2022 generally available +

+ +

Windows Server 2022 generally available

Introduction

Windows Server 2022 now generally available — Microsoft rolled out Windows Server 2022 earlier this week in an unusually understated fashion, delivers innovation in security, hybrid, and containers.

+

According to the Windows Server 2022 life cycle support page, Windows Server 2022 reached general availability on Aug 18, 2021.

+

Windows Server 2022 Lifecycle

Windows Server 2022 follows the Fixed Lifecycle Policy. Windows Server LTSCs Get 10 Years of Support, i.e. “5 years of mainstream support and 5 years of extended support”.

+

This applies to the following editions: Datacenter, Datacenter: Azure Edition, Standard

+ + + + + + + + + + + + + +
Start DateMainstream End DateExtended End Date
Aug 18, 2021Oct 13, 2026Oct 14, 2031
+

Windows Server 2022 Features

HTTPS and TLS 1.3 Enabled by Default

Windows Server 2022 use the latest security protocols, including HTTPS and TLS 1.3 by default. The server have TLS 1.0 and TLS 1.1 turned off by default.

+

Encrypted DNS queries with DoH

DNS Client in Windows Server 2022 now supports DNS-over-HTTPS (DoH) which encrypts DNS queries using the HTTPS protocol. This helps keep your traffic as private as possible by preventing eavesdropping and your DNS data being manipulated. Learn more about configuring the DNS client to use DoH.

+

SMB AES-256 Encryption

Windows Server now supports AES-256-GCM and AES-256-CCM cryptographic suites for SMB encryption and signing. Windows will automatically negotiate this more advanced cipher method when connecting to another computer that also supports it, and it can also be mandated through Group Policy. Windows Server still supports AES-128 for down-level compatibility.

+

SMB Direct and RDMA Encryption

SMB Direct and RDMA supply high bandwidth, low latency networking fabric for workloads like Storage Spaces Direct, Storage Replica, Hyper-V, Scale-out File Server, and SQL Server.

+
+

In the past, if you were doing SMB direct and using SMB as a fabric, we did not let you encrypt. If you wanted to use encryption we’d let you turn it on and then we would turn off RDMA. Your performance would be really really terrible. Now, you’re going to have the best of both worlds.

+
+

Server Message Block over QUIC

SMB over QUIC updates the SMB 3.1.1 protocol in Windows Server 2022, it relies on the User Datagram Protocol (UDP) and the Transport Layer Security (TLS) 1.3 protocols. Mobile and telecommuter users no longer need a VPN to access their file servers over SMB when on Windows. More information can be found at the SMB over QUIC documentation.

+

SMB Compression

Windows Server 2022 has an SMB compression capability that can optionally compress files to speed up file transfers.

+

Per demonstrated how SMB compression handled a 20GB file during a robocopy operation, it took almost three minutes to compress the 20GB file during the robocopy operation without SMB compression. With SMB compression turned on, the compression time was reduced to about 30 seconds. These compression benefits extend to end users accessing a file share through Windows Explorer, as well.

+

UDP performance improvements

UDP is becoming a very popular protocol carrying more and more network traffic. The increasing popularity of RTP and custom (UDP) streaming and gaming protocols The QUIC protocol, built on top of UDP, brings the performance of UDP to a level on par with TCP. Significantly, Windows Server 2022 includes UDP Segmentation Offload (USO). USO moves most of the work required to send UDP packets from the CPU to the network adapter’s specialized hardware. Complimenting USO is UDP Receive Side Coalescing (UDP RSC), which coalesces packets and reduces CPU usage for UDP processing. In addition, we have also made hundreds of improvements to the UDP data path both transmit and receive. Windows Server 2022 and Windows 11 both have this new capability.

+

TCP performance improvements

Windows Server 2022 uses TCP HyStart++ to reduce packet loss during connection start-up (especially in high-speed networks) and RACK-TLP Loss Detection Algorithm to reduce Retransmit TimeOuts (RTO). These features are enabled in the transport stack by default and provide a smoother network data flow with better performance at high speeds. Windows Server 2022 and Windows 11 both have this new capability.

+

Application platform

There are several platform improvements for Windows Containers, including application compatibility and the Windows Container experience with Kubernetes. A major improvement includes reducing the Windows Container image size by up to 40%, which leads to a 30% faster startup time and better performance.

+

You can now also run applications that depend on Azure Active Directory with group Managed Services Accounts (gMSA) without domain joining the container host, and Windows Containers now support Microsoft Distributed Transaction Control (MSDTC) and Microsoft Message Queuing (MSMQ).

+

There are several other enhancements that simplify the Windows Container experience with Kubernetes. These enhancements include support for host-process containers for node configuration, IPv6, and consistent network policy implementation with Calico.

+

Conclusion

Windows Server 2022 has some notable new features. On the security side, it has Secured Core boot protection, TLS 1.3 protocol use by default and Domain Name System over HTTPS encryption. Communications will be better protected from viewing with Server Message Block (SMB) over QUIC capability. The server also will have SMB compression for speedier file access.

+

Reference

+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2021/09/05/alpine-3-14-on-wsl2/index.html b/2021/09/05/alpine-3-14-on-wsl2/index.html new file mode 100644 index 00000000..3e57b109 --- /dev/null +++ b/2021/09/05/alpine-3-14-on-wsl2/index.html @@ -0,0 +1,198 @@ + + + + + + + + + + + + Alpine 3.14 on WSL2 | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Alpine 3.14 on WSL2 +

+ +

Alpine 3.14 on WSL2

Introduction

There is no official Alpine Linux image for WSL2, let’s do ourself.

+

Import Alpine Mini RootFS to WSL2

1
2
3
mkdir alpine-3.14/
curl -LO https://dl-cdn.alpinelinux.org/alpine/v3.14/releases/x86_64/alpine-minirootfs-3.14.2-x86_64.tar.gz
wsl --import "Alpine-3.14" alpine-3.14/ alpine-minirootfs-3.14.2-x86_64.tar.gz --version 2
+ +

Run The Alpine Linux on WSL2

1
wsl -d Alpine-3.14
+ +

Setup WSL2 Network

1
2
3
4
5
6
7
8
9
10
11
cat << EOF > /etc/wsl.conf
[network]
generateResolvConf = false
EOF

rm -f /etc/resolv.conf && cat << EOF > /etc/resolv.conf
nameserver 114.114.114.114
nameserver 1.1.1.1
nameserver 8.8.8.8
nameserver 9.9.9.9
EOF
+ +

APK Update

1
2
3
4
5
6
# apk update
fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/community/x86_64/APKINDEX.tar.gz
v3.14.2-40-gf566f645a9 [https://dl-cdn.alpinelinux.org/alpine/v3.14/main]
v3.14.2-41-gf6accde870 [https://dl-cdn.alpinelinux.org/alpine/v3.14/community]
OK: 14938 distinct packages available
+ +
1
2
# uname -mrs
Linux 5.4.72-microsoft-standard-WSL2 x86_64
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2021/09/11/cross-build-freebsd-program-in-linux/index.html b/2021/09/11/cross-build-freebsd-program-in-linux/index.html new file mode 100644 index 00000000..02b5e59d --- /dev/null +++ b/2021/09/11/cross-build-freebsd-program-in-linux/index.html @@ -0,0 +1,236 @@ + + + + + + + + + + + + Cross-build FreeBSD Program in Linux | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Cross-build FreeBSD Program in Linux +

+ +

Rust on FreeBSD

The First Steps on FreeBSD

hostname

1
2
root@freebsd-13:~ # vi /etc/rc.conf
hostname="freebsd-13"
+ +

hvn0

1
2
3
4
5
6
7
8
9
10
11
12
13
root@freebsd-13:~ # vi /etc/rc.conf

#defaultrouter="192.168.1.1"
#ifconfig_hn0="inet 192.168.1.130/24"

ifconfig_hn0="DHCP"
ifconfig_hn0_ipv6="inet6 accept_rtadv"


root@freebsd-13:~ # dmesg | grep hn0
hn0: <Hyper-V Network Interface> on vmbus0
hn0: Ethernet address: 5c:a4:fe:98:5f:41
hn0: link state changed to UP
+ +

disk

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
root@freebsd-13:~ # df -h
Filesystem Size Used Avail Capacity Mounted on
zroot/ROOT/default 20G 3.1G 17G 16% /
devfs 1.0K 1.0K 0B 100% /dev
/dev/da0p1 260M 1.8M 258M 1% /boot/efi
zroot/tmp 17G 8.8M 17G 0% /tmp
zroot/var/log 17G 180K 17G 0% /var/log
zroot 17G 96K 17G 0% /zroot
zroot/var/audit 17G 96K 17G 0% /var/audit
zroot/usr/ports 18G 711M 17G 4% /usr/ports
zroot/var/tmp 17G 96K 17G 0% /var/tmp
zroot/usr/src 17G 96K 17G 0% /usr/src
zroot/var/mail 17G 120K 17G 0% /var/mail
zroot/var/crash 17G 96K 17G 0% /var/crash
zroot/usr/home 17G 83M 17G 0% /usr/home
+ +
1
2
3
4
5
6
7
8
9
10
11
12
13
14
root@freebsd-13:~ # mount
zroot/ROOT/default on / (zfs, NFS exported, local, noatime, nfsv4acls)
devfs on /dev (devfs)
/dev/da0p1 on /boot/efi (msdosfs, local)
zroot/tmp on /tmp (zfs, local, noatime, nosuid, nfsv4acls)
zroot/var/log on /var/log (zfs, local, noatime, noexec, nosuid, nfsv4acls)
zroot on /zroot (zfs, local, noatime, nfsv4acls)
zroot/var/audit on /var/audit (zfs, local, noatime, noexec, nosuid, nfsv4acls)
zroot/usr/ports on /usr/ports (zfs, local, noatime, nosuid, nfsv4acls)
zroot/var/tmp on /var/tmp (zfs, local, noatime, nosuid, nfsv4acls)
zroot/usr/src on /usr/src (zfs, local, noatime, nfsv4acls)
zroot/var/mail on /var/mail (zfs, local, nfsv4acls)
zroot/var/crash on /var/crash (zfs, local, noatime, noexec, nosuid, nfsv4acls)
zroot/usr/home on /usr/home (zfs, local, noatime, nfsv4acls)
+ +

rc.conf

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
root@freebsd-13:~ # vi /etc/rc.conf
hostname="freebsd-13"

# defaultrouter="192.168.1.1"
# ifconfig_hn0="inet 192.168.1.130/24"

ifconfig_hn0="DHCP"
ifconfig_hn0_ipv6="inet6 accept_rtadv"

sshd_enable="YES"
ntpdate_enable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="NO"
zfs_enable="YES"

sendmail_enable="NO"
sendmail_submit_enable="NO"
sendmail_outbound_enable="NO"
sendmail_msp_queue_enable="NO"

nfs_server_enable="YES"
nfsv4_server_only="YES"
nfsv4_server_enable="YES"
mountd_enable="YES"
nfs_client_enable="YES"

dbus_enable="YES"
avahi_daemon_enable="YES"

linux_enable="YES"
linux_mounts_enable="YES"
+ +

sshd

1
2
3
4
5
6
7
8
9
root@freebsd-13:~ # touch $HOME/.hushlogin

root@freebsd-13:~ # vi /etc/ssh/sshd_config
PermitRootLogin yes
PasswordAuthentication yes
UseDNS no

root@freebsd-13:~ # /etc/rc.d/sshd reload
Performing sanity check on sshd configuration.
+ +

pkg

1
2
3
4
root@freebsd-13:~ # vi ~/.profile
# export PS1="\u@\h:\w \\$ "

. "$HOME/.cargo/env"
+ +
1
2
3
4
5
6
7
8
9
10
root@freebsd-13:~ # pkg update
Updating FreeBSD repository catalogue...
Fetching packagesite.txz: 100% 6 MiB 1.1MB/s 00:06
Processing entries: 100%
FreeBSD repository update completed. 30745 packages processed.
All repositories are up to date.

root@freebsd-13:~ # pkg info

root@freebsd-13:~ # pkg upgrade -y
+ +

cc

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
root@freebsd-13:~ # cat << EOF | cc -std=c11 -march=haswell -O2 -s -o hello -x c -
#include <stdio.h>
int main()
{
printf("Hello, World!\n");
return 0;
}
EOF

root@freebsd-13:~ # du -ks hello
5 hello

root@freebsd-13:~ # file hello
hello: ELF 64-bit LSB executable, x86-64, version 1 (FreeBSD), dynamically linked, interpreter /libexec/ld-elf.so.1, for FreeBSD 13.0 (1300139), FreeBSD-style, stripped

root@freebsd-13:~ # readelf -hld hello | grep -E "NEEDED|interpreter"
[Requesting program interpreter: /libexec/ld-elf.so.1]
0x0000000000000001 (NEEDED) Shared library: [libc.so.7]

root@freebsd-13:~ # ldd hello
hello:
libc.so.7 => /lib/libc.so.7 (0x800245000)
+ +

c++

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
root@freebsd-13:~ # cat << EOF | c++ -std=c++17 -march=haswell -O2 -s -o hello.c++ -x c++ -
#include <iostream>
int main()
{
std::cout << "Hello, World!" << std::endl;
return 0;
}
EOF

root@freebsd-13:~ # du -ks hello.c++
9 hello.c++

root@freebsd-13:~ # file hello.c++
hello.c++: ELF 64-bit LSB executable, x86-64, version 1 (FreeBSD), dynamically linked, interpreter /libexec/ld-elf.so.1, for FreeBSD 13.0 (1300139), FreeBSD-style, stripped

root@freebsd-13:~ # readelf -hld hello.c++ | grep -E "NEEDED|interpreter"
[Requesting program interpreter: /libexec/ld-elf.so.1]
0x0000000000000001 (NEEDED) Shared library: [libc++.so.1]
0x0000000000000001 (NEEDED) Shared library: [libcxxrt.so.1]
0x0000000000000001 (NEEDED) Shared library: [libm.so.5]
0x0000000000000001 (NEEDED) Shared library: [libgcc_s.so.1]
0x0000000000000001 (NEEDED) Shared library: [libc.so.7]

root@freebsd-13:~ # ldd hello.c++
hello.c++:
libc++.so.1 => /usr/lib/libc++.so.1 (0x800246000)
libcxxrt.so.1 => /lib/libcxxrt.so.1 (0x800318000)
libm.so.5 => /lib/libm.so.5 (0x80033b000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x80036e000)
libc.so.7 => /lib/libc.so.7 (0x800387000)
+ +

Copy FreeBSD Library Files to Linux

We can copy all files under /lib and /usr/lib:

+
1
2
3
4
root@freebsd-13:~ # du -ms /lib /usr/lib /usr/include
9 /lib
208 /usr/lib
16 /usr/include
+ +

or a few of them:

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
root@linux:/opt $ du -ms x86_64-unknown-freebsd/
31 x86_64-unknown-freebsd/
3 x86_64-unknown-freebsd/lib
2 x86_64-unknown-freebsd/usr/lib
27 x86_64-unknown-freebsd/usr/include

root@linux:/opt/x86_64-unknown-freebsd $ find . ! -type d | xargs du -ks
1936 ./lib/libc.so.7
128 ./lib/libcxxrt.so.1
128 ./lib/libgcc_s.so.1
384 ./lib/libm.so.5
256 ./lib/libthr.so.3
192 ./lib/libutil.so.9
26860 ./usr/include
16 ./usr/lib/Scrt1.o
16 ./usr/lib/crt1.o
8 ./usr/lib/crtbegin.o
8 ./usr/lib/crtbeginS.o
4 ./usr/lib/crtend.o
4 ./usr/lib/crtendS.o
4 ./usr/lib/crti.o
4 ./usr/lib/crtn.o
896 ./usr/lib/libc++.so.1
0 ./usr/lib/libc.so
48 ./usr/lib/libc_nonshared.a
0 ./usr/lib/libexecinfo.so
16 ./usr/lib/libexecinfo.so.1
0 ./usr/lib/libgcc_s.so
0 ./usr/lib/libm.so
640 ./usr/lib/libprocstat.a
0 ./usr/lib/libprocstat.so
64 ./usr/lib/libprocstat.so.1
0 ./usr/lib/libpthread.so
0 ./usr/lib/librt.so
48 ./usr/lib/librt.so.1
0 ./usr/lib/libthr.so
0 ./usr/lib/libutil.so
+ +

Archive Library Files on FreeBSD

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
root@freebsd-13:~ # tar --no-acls --no-xattrs --no-fflags -cvzf x86_64-unknown-freebsd_13.0-RELEASE-p4-rust.tar.gz \
/lib/libc.so.7 \
/lib/libcxxrt.so.1 \
/lib/libgcc_s.so.1 \
/lib/libm.so.5 \
/lib/libthr.so.3 \
/lib/libutil.so.9 \
/usr/lib/Scrt1.o \
/usr/lib/crt1.o \
/usr/lib/crtbegin.o \
/usr/lib/crtbeginS.o \
/usr/lib/crtend.o \
/usr/lib/crtendS.o \
/usr/lib/crti.o \
/usr/lib/crtn.o \
/usr/lib/libc++.so.1 \
/usr/lib/libc.so \
/usr/lib/libc_nonshared.a \
/usr/lib/libexecinfo.so \
/usr/lib/libexecinfo.so.1 \
/usr/lib/libgcc_s.so \
/usr/lib/libm.so \
/usr/lib/libprocstat.a \
/usr/lib/libprocstat.so \
/usr/lib/libprocstat.so.1 \
/usr/lib/libpthread.so \
/usr/lib/librt.so \
/usr/lib/librt.so.1 \
/usr/lib/libthr.so \
/usr/lib/libutil.so
+ +

Extract FreeBSD Library Files on Linux

1
2
root@linux:~ $ mkdir -p /opt/x86_64-unknown-freebsd
root@linux:~ ssh root@freebsd-13.local 'cat x86_64-unknown-freebsd_13.0-RELEASE-p4-rust.tar.gz' | tar -xvz -C /opt/x86_64-unknown-freebsd
+ +

Install clang and lld on Linux

1
sudo apt-get install -y clang lld
+ +

Install Rust on Linux

1
2
3
4
5
6
7
8
9
10
11
12
root@linux:~ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

root@linux:~ . "$HOME/.cargo/env"

root@linux:~ $ cargo --verbose --version
cargo 1.55.0 (32da73ab1 2021-08-23)
release: 1.55.0
commit-hash: 32da73ab19417aa89686e1d85c1440b72fdf877d
commit-date: 2021-08-23

root@linux:~ $ rustc --version
rustc 1.55.0 (c8dfcfe04 2021-09-06)
+ +

Cargo’s Configuration on Linux

Cargo allows local configuration for a particular package as well as global configuration. It looks for configuration files in the current directory and all parent directories.

+
    +
  • .cargo/config.toml
  • +
  • (all parent directories)/.cargo/config.toml
  • +
  • $CARGO_HOME/config.toml which defaults to:
      +
    • Windows: %USERPROFILE%.cargo\config.toml
    • +
    • Unix: $HOME/.cargo/config.toml, ${CARGO_HOME:-${HOME}/.cargo}/config.toml
    • +
    +
  • +
+

Now we can make rust target x86_64-unknown-FreeBSD use directory /opt/x86_64-unknown-FreeBSD as sysroot:

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
[http]
ssl-version = "tlsv1.3"

[profile.release]
lto = "fat"
opt-level = "s"
codegen-units = 1

[target.'cfg(target_arch = "x86_64")']
rustflags = ["-Ctarget-cpu=x86-64-v3"]

[target.'cfg(any(target_family = "windows", target_env = "msvc", target_env = "musl")']
rustflags = ["-Ctarget-feature=+crt-static"]

[target.x86_64-unknown-freebsd]
# 13.0-RELEASE-p4, FreeBSD clang version 11.0.1
linker="clang"
rustflags = ["-Clink-arg=-s", "-Clink-arg=-v", "-Clink-arg=-fuse-ld=lld", "-Clink-arg=--target=x86_64-unknown-freebsd",
"-Clink-arg=--sysroot=/opt/x86_64-unknown-freebsd"]
+ +

Cross-build FreeBSD Program in Linux

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
root@linux:~ uname -msr
Linux 5.10.0-8-amd64 x86_64

root@linux:~ cargo build -v --release --target x86_64-unknown-freebsd
...
Finished release [optimized] target(s) in 8.67s

root@linux:~ $ du -ks target/x86_64-unknown-freebsd/release/hello
236 target/x86_64-unknown-freebsd/release/hello

root@linux:~ $ file target/x86_64-unknown-freebsd/release/hello
target/x86_64-unknown-freebsd/release/hello: ELF 64-bit LSB pie executable, x86-64, version 1 (FreeBSD), dynamically linked, interpreter /libexec/ld-elf.so.1, FreeBSD-style, stripped

root@linux:~ $ readelf -ld target/x86_64-unknown-freebsd/release/hello | grep -E "interpreter:|NEEDED"
[Requesting program interpreter: /libexec/ld-elf.so.1]
0x0000000000000001 (NEEDED) Shared library: [libthr.so.3]
0x0000000000000001 (NEEDED) Shared library: [libgcc_s.so.1]
0x0000000000000001 (NEEDED) Shared library: [libc.so.7]

root@linux:~ $ scp target/x86_64-unknown-freebsd/release/hello root@freebsd-13.local:/tmp/

root@linux:~ $ ssh root@freebsd-13.local /tmp/hello
Hello, world!

root@linux:~ $ ssh root@freebsd-13.local uname -msr
FreeBSD 13.0-RELEASE-p4 amd64
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2021/09/12/cross-build-netbsd-program-in-linux/index.html b/2021/09/12/cross-build-netbsd-program-in-linux/index.html new file mode 100644 index 00000000..6c82fb12 --- /dev/null +++ b/2021/09/12/cross-build-netbsd-program-in-linux/index.html @@ -0,0 +1,238 @@ + + + + + + + + + + + + Cross-build NetBSD Program in Linux | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Cross-build NetBSD Program in Linux +

+ +

Rust on NetBSD

The First Steps on NetBSD

hostname

1
2
root@netbsd-9:~ vi /etc/myname
netbsd-9
+ +

hvn0

1
2
3
4
5
6
7
8
root@netbsd-9:~ dmesg | grep hvn
[ 1.299320] hvn0 at vmbus0: Hyper-V NetVSC
[ 1.299320] hvn0: NVS 5.0 NDIS 6.30
[ 1.299320] hvn0: Ethernet address 60:33:d9:6d:64:12

root@netbsd-9:~ vi /etc/ifconfig.hvn0
up
media manual
+ +

disk

1
2
3
4
5
6
7
8
root@netbsd-9:~ df -h
Filesystem Size Used Avail %Cap Mounted on
/dev/dk1 60G 2.2G 55G 3% /
tmpfs 512M 244K 511M 0% /tmp
kernfs 1.0K 1.0K 0B 100% /kern
ptyfs 1.0K 1.0K 0B 100% /dev/pts
procfs 4.0K 4.0K 0B 100% /proc
tmpfs 512M 4.0K 512M 0% /var/shm
+ +
1
2
3
4
5
6
7
root@netbsd-9:~ cat /proc/mounts
/dev/dk1 / ffs rw 0 0
tmpfs /tmp tmpfs rw 0 0
kernfs /kern kernfs rw 0 0
ptyfs /dev/pts ptyfs rw 0 0
procfs /proc proc rw 0 0
tmpfs /var/shm tmpfs rw 0 0
+ +

rc.conf

1
2
3
4
5
6
7
8
9
10
root@netbsd-9:/etc vi /etc/rc.conf
# Add local overrides below.
#
dhcpcd=YES
dhcpcd_flags="-qM hvn0"
sshd=YES
ntpd=YES
ntpdate=YES
mdnsd=YES
wscons=YES
+ +

sshd

1
2
3
4
5
6
root@netbsd-9:~ vi /etc/ssh/sshd_config
PermitRootLogin yes
PasswordAuthentication yes
UseDNS no

root@netbsd-9:~ /etc/rc.d/sshd reload
+ +

repositories.conf

1
2
3
4
5
root@netbsd-9:~ cat << EOF > /usr/pkg/etc/pkgin/repositories.conf
https://cdn.NetBSD.org/pub/pkgsrc/packages/NetBSD/x86_64/9.2/All/
https://cdn.NetBSD.org/pub/pkgsrc/packages/NetBSD/x86_64/9.1/All/
https://cdn.NetBSD.org/pub/pkgsrc/packages/NetBSD/x86_64/9.0/All/
EOF
+ +

pkg

1
2
3
4
5
6
7
8
9
10
root@netbsd-9:~ vi ~/.profile
# export PS1="\u@\h:\w \\$ "
export PS1=`whoami`@`hostname -s`:${PWD}" $ "

export PKG_PATH=https://cdn.NetBSD.org/pub/pkgsrc/packages/NetBSD/x86_64/9.2/All
export PKG_PATH="${PKG_PATH};https://cdn.NetBSD.org/pub/pkgsrc/packages/NetBSD/x86_64/9.2/All"
export PKG_PATH="${PKG_PATH};https://cdn.NetBSD.org/pub/pkgsrc/packages/NetBSD/x86_64/9.1/All"
export PKG_PATH="${PKG_PATH};https://cdn.NetBSD.org/pub/pkgsrc/packages/NetBSD/x86_64/9.0/All"

. "$HOME/.cargo/env"
+ +
1
2
3
4
5
6
7
8
pkg_admin fetch-pkg-vulnerabilities
pkg_add -uv tmux pkgin curl ca-certificates

pkg_info tmux

pkg_delete -r jpeg

pkgin update
+ +

cc

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
root@netbsd-9# cat << EOF | cc -std=c11 -march=haswell -O2 -s -o hello -x c -
#include <stdio.h>
int main()
{
printf("Hello, World!\n");
return 0;
}
EOF

root@netbsd-9# du -ks hello
6 hello

root@netbsd-9# file hello
hello: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /usr/libexec/ld.elf_so, for NetBSD 9.2, stripped

root@netbsd-9# readelf -hld hello | grep -E "NEEDED|interpreter"
[Requesting program interpreter: /usr/libexec/ld.elf_so]
0x0000000000000001 (NEEDED) Shared library: [libc.so.12]

root@netbsd-9# ldd hello
hello:
-lc.12 => /usr/lib/libc.so.12
+ +

c++

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
root@netbsd-9# cat << EOF | c++ -std=c++17 -march=haswell -O2 -s -o hello.c++ -x c++ -
#include <iostream>
int main()
{
std::cout << "Hello, World!" << std::endl;
return 0;
}
EOF

root@netbsd-9# du -ks hello.c++
8 hello.c++

root@netbsd-9# file hello.c++
hello.c++: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /usr/libexec/ld.elf_so, for NetBSD 9.2, stripped


root@netbsd-9# readelf -hld hello.c++ | grep -E "NEEDED|interpreter"
[Requesting program interpreter: /usr/libexec/ld.elf_so]
0x0000000000000001 (NEEDED) Shared library: [libstdc++.so.9]
0x0000000000000001 (NEEDED) Shared library: [libm.so.0]
0x0000000000000001 (NEEDED) Shared library: [libc.so.12]

root@netbsd-9# ldd hello.c++
hello.c++:
-lstdc++.9 => /usr/lib/libstdc++.so.9
-lm.0 => /usr/lib/libm.so.0
-lc.12 => /usr/lib/libc.so.12
-lgcc_s.1 => /usr/lib/libgcc_s.so.1
+ +

Copy NetBSD Library Files to Linux

We can copy all files under /lib and /usr/lib:

+
1
2
3
4
root@netbsd-9:/ du -ms /lib /usr/lib /usr/include
10 /lib
287 /usr/lib
25 /usr/include
+ +

or a few of them:

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
root@linux:/opt du -ms x86_64-unknown-netbsd
35 x86_64-unknown-netbsd/
3 x86_64-unknown-netbsd/lib
5 x86_64-unknown-netbsd/usr/lib
27 x86_64-unknown-netbsd/usr/include

root@linux:/opt/x86_64-unknown-netbsd $ find . ! -type d | xargs du -ks
0 ./lib/libc.so
2032 ./lib/libc.so.12.213
0 ./lib/libgcc_s.so
96 ./lib/libgcc_s.so.1.0
0 ./lib/libm.so
204 ./lib/libm.so.0.12
0 ./lib/libpthread.so
92 ./lib/libpthread.so.1.4
0 ./lib/libutil.so
124 ./lib/libutil.so.7.24
27380 ./usr/include
4 ./usr/lib/crt0.o
4 ./usr/lib/crtbegin.o
4 ./usr/lib/crtbeginS.o
0 ./usr/lib/crtbeginT.o
4 ./usr/lib/crtend.o
0 ./usr/lib/crtendS.o
4 ./usr/lib/crti.o
4 ./usr/lib/crtn.o
8 ./usr/lib/gcrt0.o
4648 ./usr/lib/libc.a
96 ./usr/lib/libpthread.a
32 ./usr/lib/librt.a
0 ./usr/lib/librt.so
16 ./usr/lib/librt.so.1.1
224 ./usr/lib/libutil.a
+ +

Archive Library Files on NetBSD

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
root@netbsd-9:~ tar --no-acls --no-xattrs --no-fflags -cvzf x86_64-unknown-netbsd_9.2-STABLE-rust.tar.gz \
/lib/libc.so \
/lib/libc.so.12.213 \
/lib/libgcc_s.so \
/lib/libgcc_s.so.1.0 \
/lib/libm.so \
/lib/libm.so.0.12 \
/lib/libpthread.so \
/lib/libpthread.so.1.4 \
/lib/libutil.so \
/lib/libutil.so.7.24 \
/usr/include \
/usr/lib/crt0.o \
/usr/lib/crtbegin.o \
/usr/lib/crtbeginS.o \
/usr/lib/crtbeginT.o \
/usr/lib/crtend.o \
/usr/lib/crtendS.o \
/usr/lib/crti.o \
/usr/lib/crtn.o \
/usr/lib/gcrt0.o \
/usr/lib/libc.a \
/usr/lib/libpthread.a \
/usr/lib/librt.a \
/usr/lib/librt.so \
/usr/lib/librt.so.1.1 \
/usr/lib/libutil.a
+ +

Extract NetBSD Library Files on Linux

1
2
root@linux:~ mkdir -p /opt/x86_64-unknown-netbsd
root@linux:~ ssh root@netbsd-9.local 'cat x86_64-unknown-netbsd_9.2-STABLE-rust.tar.gz' | tar -xvz -C /opt/x86_64-unknown-netbsd
+ +

Install clang and lld on Linux

1
sudo apt-get install -y clang lld
+ +

Install Rust on Linux

1
2
3
4
5
6
7
8
9
10
11
12
root@linux:~ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

root@linux:~ . "$HOME/.cargo/env"

root@linux:~ cargo --verbose --version
cargo 1.55.0 (32da73ab1 2021-08-23)
release: 1.55.0
commit-hash: 32da73ab19417aa89686e1d85c1440b72fdf877d
commit-date: 2021-08-23

root@linux:~ rustc --version
rustc 1.55.0 (c8dfcfe04 2021-09-06)
+ +

Cargo’s Configuration on Linux

Cargo allows local configuration for a particular package as well as global configuration. It looks for configuration files in the current directory and all parent directories.

+
    +
  • .cargo/config.toml
  • +
  • (all parent directories)/.cargo/config.toml
  • +
  • $CARGO_HOME/config.toml which defaults to:
      +
    • Windows: %USERPROFILE%.cargo\config.toml
    • +
    • Unix: $HOME/.cargo/config.toml, ${CARGO_HOME:-${HOME}/.cargo}/config.toml
    • +
    +
  • +
+

Now we can make rust target x86_64-unknown-netbsd use directory /opt/x86_64-unknown-netbsd as sysroot:

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
[http]
ssl-version = "tlsv1.3"

[profile.release]
lto = "fat"
opt-level = "s"
codegen-units = 1

[target.'cfg(target_arch = "x86_64")']
rustflags = ["-Ctarget-cpu=x86-64-v3"]

[target.'cfg(any(target_family = "windows", target_env = "msvc", target_env = "musl")']
rustflags = ["-Ctarget-feature=+crt-static"]

[target.x86_64-unknown-netbsd]
# cargo build -v --release --target x86_64-unknown-netbsd
# NetBSD 9.2_STABLE amd64, gcc 7.5.0
linker="clang"
rustflags = ["-Clink-arg=-s", "-Clink-arg=-v", "-Clink-arg=-fuse-ld=lld", "-Clink-arg=--target=x86_64-unknown-netbsd",
"-Clink-arg=--sysroot=/opt/x86_64-unknown-netbsd", "-Clink-arg=-L/opt/x86_64-unknown-netbsd/lib", "-Clink-arg=-L/opt/x86_64-unknown-netbsd/usr/lib"]
+ +

Cross-build NetBSD Program in Linux

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
root@linux:~ uname -msr
Linux 5.10.0-8-amd64 x86_64

root@linux:~ cargo build -v --release --target x86_64-unknown-netbsd
...
Finished release [optimized] target(s) in 11.59s

root@linux:~ du -ks target/x86_64-unknown-netbsd/release/hello
240 target/x86_64-unknown-netbsd/release/hello

root@linux:~ file target/x86_64-unknown-netbsd/release/hello
target/x86_64-unknown-netbsd/release/hello: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /libexec/ld.elf_so, for NetBSD 9.2, stripped

root@linux:~ readelf -ld target/x86_64-unknown-netbsd/release/hello | grep -E "interpreter:|NEEDED"
[Requesting program interpreter: /libexec/ld.elf_so]
0x0000000000000001 (NEEDED) Shared library: [libpthread.so.1]
0x0000000000000001 (NEEDED) Shared library: [libgcc_s.so.1]
0x0000000000000001 (NEEDED) Shared library: [libc.so.12]

root@linux:~ scp target/x86_64-unknown-netbsd/release/hello root@netbsd-9.local:/tmp/

root@linux:~ ssh root@netbsd-9.local /tmp/hello
Hello, world!

root@linux:~ ssh root@netbsd-9.local uname -msr
NetBSD 9.2_STABLE amd64
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2021/09/19/how-to-mount-qemu-disk-image/index.html b/2021/09/19/how-to-mount-qemu-disk-image/index.html new file mode 100644 index 00000000..7afbf624 --- /dev/null +++ b/2021/09/19/how-to-mount-qemu-disk-image/index.html @@ -0,0 +1,204 @@ + + + + + + + + + + + + How to Mount QEMU Disk Image | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ How to Mount QEMU Disk Image +

+ +

How to Mount QEMU Disk Image

Load NBD Kernel Module on The Host

1
2
3
4
5
$ sudo modprobe nbd max_part=16 nbds_max=16

$ ls /dev/nbd*
/dev/nbd0 /dev/nbd10 /dev/nbd12 /dev/nbd14 /dev/nbd2 /dev/nbd4 /dev/nbd6 /dev/nbd8
/dev/nbd1 /dev/nbd11 /dev/nbd13 /dev/nbd15 /dev/nbd3 /dev/nbd5 /dev/nbd7 /dev/nbd9
+ +

Connect the QEMU Disk Image as NBD

1
2
3
4
5
6
$ qemu-img convert -f raw -O qcow2 src.raw dst.qcow2

$ qemu-img resize dst.qcow2 48G
Image resized.

$ sudo qemu-nbd --connect=/dev/nbd0 my.qcow2
+ +

Find The Desired NBD Partition

1
2
3
4
5
$ dmesg | grep nbd
[92223.517473] nbd0: p1 p12 p13 p14 p15
[92223.518662] nbd0: p1 p12 p13 p14 p15

$ sudo fdisk /dev/nbd0 -l
+ +

Resize or Fix The Partition and File System

1
2
3
4
$ sudo sgdisk -e /dev/nbd0

$ sudo e2fsck -f /dev/nbd0p1
$ sudo resize2fs /dev/nbd0p1
+ +

Mount The Desired Partition

1
2
3
4
$ sudo mount /dev/nbd0p1 /mnt/

$ mount | grep nbd
/dev/nbd0p1 on /mnt type ext4 (rw,relatime)
+ +

If you encountered error mount: special device /dev/nbd0p1 does not exist, or similar partition table errors, please rescan partitions, tell the kernel about the latest information of partitions:

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
$ sudo partx -a /dev/nbd0

$ sudo partx -s /dev/nbd0

$ partx --help

Usage:
partx [-a|-d|-s|-u] [--nr <n:m> | <partition>] <disk>

Tell the kernel about the presence and numbering of partitions.

Options:
-a, --add add specified partitions or all of them
-d, --delete delete specified partitions or all of them
-u, --update update specified partitions or all of them
-s, --show list partitions
...
+ +

Do Something in The Desired Partition

1
2
3
4
5
$ ls /mnt/
bin boot dev etc home lib lost+found media mnt opt proc root run sbin snap srv sys tmp usr var

$ sudo du -ms /mnt/
3127 /mnt/
+ +

Unmount File System and Disconnect NBD

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$ sudo umount /mnt

$ sudo qemu-nbd --disconnect /dev/nbd0
/dev/nbd0 disconnected

$ sudo rmmod nbd

$ dmesg | grep nbd
[92223.517473] nbd0: p1 p12 p13 p14 p15
[92223.518662] nbd0: p1 p12 p13 p14 p15
[92412.338838] nbd0: p1 p12 p13 p14 p15
[92534.871085] EXT4-fs (nbd0p1): mounted filesystem with ordered data mode. Opts: (null)
[92794.269063] block nbd0: NBD_DISCONNECT
[92794.269077] block nbd0: Disconnected due to user request.
[92794.269078] block nbd0: shutting down sockets
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2021/09/20/nested-virtualization/index.html b/2021/09/20/nested-virtualization/index.html new file mode 100644 index 00000000..2c23c4dd --- /dev/null +++ b/2021/09/20/nested-virtualization/index.html @@ -0,0 +1,321 @@ + + + + + + + + + + + + Nested virtualization | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Nested virtualization +

+ +

Nested virtualization

Nested virtualization allows you to run a virtual machine (VM) inside another VM while still using hardware acceleration from the host.

+

naming conventions:

+
    +
  • L0 hypervisor, or Bare-metal host – this is the hypervisor that runs on the physical bare-metal server
  • +
  • L1 hypervisor or Guest hypervisor – this is a hypervisor that runs as a virtual machine in the L0 hypervisor.
  • +
  • L2 guests, or nested guests – these are virtual machines running in L1 hypervisor.
  • +
+

Hardware virtualization support

Hardware virtualization support or hardware-assisted virtualization is a set of processor extensions to the x86 architecture. These extensions address issues with the virtualization of some privileged instructions and the performance of virtualized system memory. Intel’s implementation is called VT-x and AMD’s implementation is called AMD-V. This feature was introduced in 2005 and 2006 and is available in most current CPUs. Some exceptions are lower-end Atom processor. However, this feature might be disabled in the BIOS.

+

Challenges of Nested Virtualization

    +
  • Extra Overheads – Potentially lower performance
      +
    • Higher VM Exit rates (Next slides)
    • +
    • Software overhead of virtualizing “H/W virtualization features”
    • +
    +
  • +
  • Complexity of Root VMM Software
      +
    • More surface areas for security attacks
    • +
    • Sometimes exposes existing bugs with (Guest) VMMs
    • +
    +
  • +
  • Requires more QA because of various combinations
  • +
+

Improving Performance of Nested Virtualization

    +
  • Opportunity #1: Reduce Transition Latencies
      +
    • Reduce unique overheads of virtualization. Intel is fanatically committed.
    • +
    • Optimize software code
    • +
    +
  • +
  • Opportunity #2: Reduce “Virtual” VM Exits Entirely
      +
    • EPT (Implemented as Virtual EPT)
    • +
    • APIC Virtualization
        +
      • Eliminate or reduce VM exits with access to local APIC
      • +
      • Guest VMMs can access local APICs more frequently to virtualize timers, I/O devices
      • +
      +
    • +
    • VT-d, SR-IOV
        +
      • Reduce overhead of I/O virtualization
      • +
      • Guest VMMs can access I/O devices more frequently
      • +
      +
    • +
    +
  • +
  • Opportunity #3: Eliminate VM Exits on guest VMCS Accesses
      +
    • VMCS Shadowing
    • +
    +
  • +
+

Enabling nested virtualization in KVM

Nested virtualization is a KVM feature that enables hardware-assisted virtualization in the guest hypervisors. With it, the guest hypervisor can leverage virtualization extensions of the physical CPU without need to emulate them in software.

+

Checking if virtualization is supported

To check whether hardware virtualization support is available on the host processor, check the CPU has the vmx or svm flag with the command:

+
1
# egrep --color -i "svm|vmx" /proc/cpuinfo
+ +

If you see vmx (Intel-VT technology) or svm (AMD-V support) in the output, the KVM guest machine can work as a hypervisor and host VMs.

+

Checking if nested virtualization is supported

For Intel processors, check the /sys/module/kvm_intel/parameters/nested file. For AMD processors, check the /sys/module/kvm_amd/parameters/nested file. If you see 1 or Y, nested virtualization is supported; if you see 0 or N, nested virtualization is not supported.

+

For example:

+
1
2
# cat /sys/module/kvm_intel/parameters/nested
Y
+ +

Enabling nested virtualization in Linux

Enable nested virtualization for Intel processors

H/W virtualization features:

+
    +
  • VT-x (CPU virtualization)
      +
    • VXM instructions, VMCS (Virtual Machine Control Structure), EPT (Extended Page Table), etc.
    • +
    +
  • +
  • VT-d (Direct I/O)
  • +
  • VT-c (Connectivity, especially SR-IOV of NIC)
  • +
+
    +
  1. Shut down all running VMs and unload the kvm_intel module
  2. +
+
1
sudo modprobe -r kvm_intel
+ +
    +
  1. Activate the nesting feature
  2. +
+
1
sudo modprobe kvm_intel nested=1
+ +
    +
  1. Enable it permanently
  2. +
+

Nested virtualization is enabled until the host is rebooted. To enable it permanently, add the following line to the /etc/modprobe.d/kvm.conf file:

+
1
options kvm_intel nested=1
+ +
VMCS shadowing

Virtual Machine Control Structure is a memory structure where the virtual CPU state is stored on VM exit and restored from on VM resume. This happens every time the guest operating system performs a privileged operation. This is done in hardware, but then the hypervisor is a virtual machine, This function has to be emulated and causes multiple VM exits to the host.

+

With VMCS shadowing for every L2 VM, a VMCS is created in the host, that is shadowed in the L1 hypervisor. This way all VM exits are implemented in hardware reducing significantly the processing overhead. VMCS shadowing is not strictly required for nested virtualization, but it gives huge performance improvement, especially on workloads involving many context switches.

+

To be able to do this a hardware support in the CPU is required. This hardware feature was introduced in Haswell processors initially in 2013 and is available in most current server CPUs.

+

To use it you need to enable it in kvm kernel module:

+

In /etc/modprobe.d/kvm-intel.conf add:

+
1
options kvm-intel enable_shadow_vmcs=1
+ +

Enable nested virtualization for AMD processors

    +
  1. Shut down all running VMs and unload the kvm_amd module
  2. +
+
1
sudo modprobe -r kvm_amd
+ +
    +
  1. Activate the nesting feature
  2. +
+
1
sudo modprobe kvm_amd nested=1
+ +
    +
  1. Enable it permanently
  2. +
+

Nested virtualization is enabled until the host is rebooted. To enable it permanently, add the following line to the /etc/modprobe.d/kvm.conf file:

+
1
options kvm_amd nested=1
+ +

Enabling nested virtualization in Hyper-V

Hyper-V is an optional component of Windows Server 2008 and later. It is also available in x64 SKUs of Pro, Enterprise and Education editions of Windows 8 and later.

+

Nested virtualization is a feature that allows you to run Hyper-V inside of a Hyper-V virtual machine (VM). This is helpful for running a Visual Studio phone emulator in a virtual machine, or testing configurations that ordinarily require several hosts.

+

Prerequisites

    +
  • Windows 10 Enterprise, Pro, or Education
  • +
  • 64-bit Processor with Second Level Address Translation (SLAT).
  • +
  • CPU support for VM Monitor Mode Extension (VT-c on Intel CPUs).
  • +
  • Minimum of 4 GB memory.
  • +
+

Intel processor with VT-x and EPT technology

    +
  • The Hyper-V host must be Windows Server 2016/Windows 10 or greater
  • +
  • VM configuration version 8.0 or greater
  • +
+

AMD EPYC/Ryzen processor or later

    +
  • The Hyper-V host must be Windows Server 2022/Windows 11 or greater
  • +
  • VM configuration version 10.0 or greater
  • +
+

Checking if Hyper-V is supported

1
2
3
C:\>systeminfo
...
Hyper-V Requirements: A hypervisor has been detected. Features required for Hyper-V will not be displayed.
+ +

Enable Hyper-V using PowerShell

Open a PowerShell console as Administrator, Run the following command:

+
1
PS C:\> Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
+ +

Configure Nested Virtualization

    +
  1. Create a virtual machine. See the prerequisites above for the required OS and VM versions.
  2. +
  3. While the virtual machine is in the OFF state, run the following command on the physical Hyper-V host. This enables nested virtualization for the virtual machine.
  4. +
+
1
Set-VMProcessor -VMName <VMName> -ExposeVirtualizationExtensions $true
+ +
    +
  1. Start the virtual machine. Install Hyper-V within the virtual machine, just like you would for a physical server.
  2. +
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2021/09/21/linux-unified-key-setup/index.html b/2021/09/21/linux-unified-key-setup/index.html new file mode 100644 index 00000000..12a89fa0 --- /dev/null +++ b/2021/09/21/linux-unified-key-setup/index.html @@ -0,0 +1,314 @@ + + + + + + + + + + + + Linux Unified Key Setup | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Linux Unified Key Setup +

+ +

Linux Unified Key Setup

Full Disk Encryption

    +
  • Transparent encryption on disk sector level
      +
    • Transparent for filesystem
    • +
    • No user decision what to encrypt
    • +
    • Encryption of hibernation and swap partitions
    • +
    +
  • +
  • Volume key – key used to encrypt data
  • +
  • Passphrase – unlocks encrypted disk
  • +
+

Linux Full Disk Encryption

    +
  • dm-crypt (kernel module) + cryptsetup (control utility)
  • +
  • LUKS (Linux Unified Key Setup)
      +
    • On-disk format to store encrypted volume key
    • +
    • Implemented inside cryptsetup library
    • +
    +
  • +
+

LUKS Common Use Cases

    +
  • Local encrypted disk
      +
    • Encrypted notebook, portable drives, …
    • +
    • Corporate notebooks – on-demand recovery
    • +
    +
  • +
  • Data center disks
      +
    • Different physical access policies in-place
    • +
    • Data disks (also Gluster bricks, Ceph OSDs, …)
    • +
    • Automatic unlocking?
    • +
    +
  • +
  • Mobile devices
      +
    • Specific environment, usually non-LUKS metadata
    • +
    +
  • +
+

LUKS Threat Example

    +
  • Asset: Confidential data on-disk +Threat: Stolen disk + => Strong encryption with random key + => Dictionary password attack resistance
  • +
  • LUKS provides data confidentiality only
  • +
  • No integrity protection
  • +
  • Protection only of locked (powered-off) device
  • +
+

Key Management

    +
  • It’s all about weak passwords :-)
  • +
  • Password-based key derivation functions
      +
    • PBKDF2
    • +
    • Argon2 (PHC winner)
    • +
    +
  • +
  • No Trusted Platform Module (TPM) bindings
  • +
  • No 2nd factors authentication.
  • +
  • No secret sharing.
  • +
+

Disk Encryption “User Survey”

    +
  • 6% does not use encryption (despite company policy :-)
  • +
  • 96% believes that encryption increases security
  • +
  • 20% lost data on encrypted disk at least once
      +
    • 59% of them lost data forever
    • +
    • 18% of them suffered corruption of encrypted disk
    • +
    +
  • +
  • 62% have backups of encrypted data
  • +
  • 1% have problem with slowdown caused by encryption
      +
    • 75% did not notice, 19% negligible slowdown
    • +
    +
  • +
+

Device-Mapper’s “crypt” target

dm-crypt is a transparent disk encryption subsystem in Linux kernel versions 2.6 and later and in DragonFly BSD. It is part of the device mapper (dm) infrastructure, and uses cryptographic routines from the kernel’s Crypto API.

+

dm-crypt is implemented as a device mapper target and may be stacked on top of other device mapper transformations. It can thus encrypt whole disks (including removable media), partitions, software RAID volumes, logical volumes, as well as files. It appears as a block device, which can be used to back file systems, swap or as an LVM physical volume.

+

Configuring File Encryption

Create a LUKS Format File

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
$ sudo apt-get install -y cryptsetup-bin

$ truncate --size 4G secret-block.raw
$ du -ms secret-block.raw
0 secret-block.raw

$ cryptsetup -y luksFormat --sector-size 4096 secret-block.raw

WARNING!
========
This will overwrite data on secret-block.raw irrevocably.

Are you sure? (Type 'yes' in capital letters): YES
Enter passphrase for secret-block.raw:
Verify passphrase:

$ du -ms secret-block.raw
16 secret-block.raw
+ +

Open LUKS Format File

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
$ sudo cryptsetup luksOpen secret-block.raw secret-block
Enter passphrase for secret-block.raw:

$ sudo cryptsetup status secret-block
/dev/mapper/secret-block is active.
type: LUKS2
cipher: aes-xts-plain64
keysize: 512 bits
key location: keyring
device: /dev/loop0
loop: secret-block.raw
sector size: 4096
offset: 32768 sectors
size: 8355840 sectors
mode: read/write

$ sudo cryptsetup luksDump /dev/loop0
LUKS header information
Version: 2
Epoch: 3
Metadata area: 16384 [bytes]
Keyslots area: 16744448 [bytes]
UUID: f5b87a43-f565-4078-a1f2-735d90c170d8
Label: (no label)
Subsystem: (no subsystem)
Flags: (no flags)

Data segments:
0: crypt
offset: 16777216 [bytes]
length: (whole device)
cipher: aes-xts-plain64
sector: 4096 [bytes]

Keyslots:
0: luks2
Key: 512 bits
Priority: normal
Cipher: aes-xts-plain64
Cipher key: 512 bits
PBKDF: argon2id
Time cost: 5
Memory: 1048576
Threads: 4
Salt: cd 80 4c b7 06 c6 6c 21 e0 f6 1e a3 64 dc 2d 3e
f3 5b e1 a3 be 38 95 20 34 d3 30 fc 03 f6 04 0b
AF stripes: 4000
AF hash: sha256
Area offset:32768 [bytes]
Area length:258048 [bytes]
Digest ID: 0
Tokens:
Digests:
0: pbkdf2
Hash: sha256
Iterations: 123419
Salt: 50 21 fd 06 c0 88 fa 3b 6a 34 08 a2 16 47 e6 b1
25 53 85 c5 2e ec 65 ae 53 94 f3 56 af df ae ef
Digest: 64 a7 08 b0 8b ac cc bf cb a6 dc 9a a4 4c 41 f0
3e d5 da 70 e4 f8 95 36 99 83 70 b3 75 23 30 f2
+ +

Protect Against Disclosure of Usage Patterns

File block data with zeros, protect against disclosure of usage patterns.

+
1
$ sudo dd if=/dev/zero of=/dev/mapper/secret-block
+ +

Create a Filesystem

1
2
3
4
5
6
7
8
9
10
11
$ sudo mkfs.xfs /dev/mapper/secret-block
meta-data=/dev/mapper/secret-block isize=512 agcount=4, agsize=261120 blks
= sectsz=4096 attr=2, projid32bit=1
= crc=1 finobt=1, sparse=1, rmapbt=0
= reflink=1 bigtime=0 inobtcount=0
data = bsize=4096 blocks=1044480, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0, ftype=1
log =internal log bsize=4096 blocks=2560, version=2
= sectsz=4096 sunit=1 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
+ +

Mount and Use Encrypted Filesystem

1
2
3
4
5
6
7
8
9
$ sudo xfs_info /dev/mapper/secret-block

$ sudo mount /dev/mapper/secret-block secret-fs
$ echo "01234567890abcdefghijklmnopqrstuvwxyz" | sudo tee secret-fs/test.txt

$ sudo umount secret-fs/
$ sudo cryptsetup luksClose /dev/mapper/secret-block

$ grep "01234567890abcdefghijklmnopqrstuvwxyz" secret-block.raw
+ +

GnuPG Encrypted Key File

1
2
3
4
$ dd if=/dev/urandom count=64 bs=1k \
| gpg --symmetric --cipher-algo AES256 --armor > /path/to/secret-block-key.gpg
$ gpg --decrypt /path/to/secret-block-key.gpg \
| cryptsetup luksFormat --sector-size 4096 secret-block.raw
+ +

Daily Usage of File Encryption

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$ sudo cryptsetup luksOpen secret-block.raw secret-block
Enter passphrase for secret-block.raw:

# Only if you use GnuPG encrypted keyfile
$ gpg --decrypt /path/to/secret-block-key.gpg \
| sudo cryptsetup luksOpen secret-block.raw secret-block
gpg: AES256.CFB encrypted data
gpg: encrypted with 1 passphrase

$ sudo mount /dev/mapper/secret-block secret-fs

$ echo "01234567890abcdefghijklmnopqrstuvwxyz" | sudo tee secret-fs/test.txt

$ sudo umount secret-fs/
$ sudo cryptsetup luksClose /dev/mapper/secret-block
+ +

Securely Integrating with QEMU

Secrets

    +
  • secret” object type (v2.6.0)
      +
    • raw or base64
    • +
    • plain text or encrypted
    • +
    • inline or file
    • +
    +
  • +
  • RBD, iSCSI, CURL, LUKS, x509 cert
      +
    • One global master secret via file
    • +
    • Per object secrets inline & encrypted
    • +
    +
  • +
+

Secrets: Creation

    +
  • Password inline as clear text (insecure) +-object secret,id=sec0,data=letmein
  • +
  • Password from a clear text file (secure) +-object secret,id=sec0,file=passwd.txt
  • +
  • Password from a base64 clear text file (secure) +-object secret,id=sec0,file=passwd.b64,format=base64
  • +
  • Password inline as aes256 cipher text (secure) +-object secret,id=sec0,file=master.aes
    -object secret,id=sec1,data=CIPHERTEXT,keyid=sec0,iv=NNNNNNNNNNNNNNN
  • +
+

Secrets: Usage

    +
  • Disks with “password-secret” property
  • +
+
1
2
3
-drive driver=rbd,\
filename=rbd:pool/image:id=myname:\
auth_supported=cephx,password-secret=sec0
+ +
    +
  • TLS cert with “passwordid” property
  • +
+
1
2
-object tls-creds-x509,dir=/etc/tls/qemu,\
id=tls0,endpoint=server,paswordid=sec0
+ +

QEMU with Plain LUKS File

1
2
3
4
5
6
7
8
9
10
11
$ qemu-img create -f luks --object secret,id=sec0,data=demo-password -o key-secret=sec0 demo.luks 64G
Formatting 'demo.luks', fmt=luks size=68719476736 key-secret=sec0

$ ls -ln demo.luks
-rw-r--r-- 1 1000 1000 68721545216 2021-09-21 21:19 demo.luks

$ stat demo.luks
File: demo.luks
Size: 68721545216 Blocks: 2048 IO Block: 4096 regular file
Device: fe01h/65025d Inode: 403937219 Links: 1
...
+ +
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
$ sudo modprobe nbd max_part=16 nbds_max=16

$ sudo qemu-nbd --connect=/dev/nbd0 --object secret,id=sec0,data=demo-password --image-opts driver=luks,key-secret=sec0,file.driver=file,file.filename=demo.luks

$ sudo fdisk /dev/nbd0 -l
$ sudo mkfs.ext4 /dev/nbd0p1
$ du -ms demo.luks
323 demo.luks

$ sudo mount /dev/nbd0p1 nbd
$ echo "01234567890abcdefghijklmnopqrstuvwxyz" | sudo tee nbd/test.txt

$ sudo umount nbd/
$ sudo qemu-nbd --disconnect /dev/nbd0
/dev/nbd0 disconnected

$ grep "01234567890abcdefghijklmnopqrstuvwxyz" demo.luks
+ +

QEMU with QCOW2 Have LUKS Payload

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$ qemu-img create -f qcow2 -o encrypt.format=luks,encrypt.key-secret=sec_luks --object secret,data=demo-password,id=sec_luks demo.qcow2 64G

Formatting 'demo.qcow2', fmt=qcow2 encrypt.format=luks encrypt.key-secret=sec_luks cluster_size=65536 extended_l2=off compression_type=zlib size=68719476736 lazy_refcounts=off refcount_bits=16

$ ls -ln demo.qcow2
-rw-r--r-- 1 1000 1000 2359296 2021-09-21 21:47 demo.qcow2

$ du -ks demo.qcow2
3328 demo.qcow2

$ stat demo.qcow2
File: demo.qcow2
Size: 2359296 Blocks: 6656 IO Block: 4096 regular file
Device: fe01h/65025d Inode: 403937216 Links: 1
...
+ +
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
$ sudo modprobe nbd max_part=16 nbds_max=16

$ sudo qemu-nbd --connect=/dev/nbd0 --object secret,id=sec0,data=demo-password --image-opts driver=qcow2,encrypt.key-secret=sec0,file.driver=file,file.filename=demo.qcow2

$ sudo fdisk /dev/nbd0 -l
$ sudo mkfs.ext4 /dev/nbd0p1
$ du -ms demo.qcow2
283 demo.qcow2

$ sudo mount /dev/nbd0p1 nbd
$ echo "01234567890abcdefghijklmnopqrstuvwxyz" | sudo tee nbd/test.txt

$ sudo umount nbd/
$ sudo qemu-nbd --disconnect /dev/nbd0
/dev/nbd0 disconnected

$ grep "01234567890abcdefghijklmnopqrstuvwxyz" demo.qcow2
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2021/09/25/linux-home-and-end-keys/index.html b/2021/09/25/linux-home-and-end-keys/index.html new file mode 100644 index 00000000..b8dfc1b9 --- /dev/null +++ b/2021/09/25/linux-home-and-end-keys/index.html @@ -0,0 +1,227 @@ + + + + + + + + + + + + Linux Home and End Keys | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Linux Home and End Keys +

+ +

Linux Home and End Keys

Update ~/.profile

1
2
3
4
5
6
7
8
export TERM=xterm-256color
export LC_ALL=C.UTF-8

if [ $(id -u) -eq 0 ]; then # you are root, set red colour prompt
PS1="\\[$(tput setaf 1)\\][\\u@\\h:\\w] \\$ \\[$(tput sgr0)\\]"
else # normal
PS1="\\[$(tput setaf 2)\\][\\u@\\h:\\w] \\$ \\[$(tput sgr0)\\]"
fi
+ +
1
2
3
4
5
6
7
8
9
10
11
$ tput cols
80

$ tput khome | cat -v; echo
^[OH

$ tput kend | cat -v; echo
^[OF

$ cat -v
^[[5~^[[F^C
+ +

Bind in ~/.bashrc

1
2
bind '"\e[1~":"\eOH"'
bind '"\e[4~":"\eOF"'
+ +

Bind in ~/.tmux.conf

1
2
bind-key -n Home send Escape "OH"
bind-key -n End send Escape "OF"
+ +

tput utility

Color capabilities

    +
  • tput setab [1-7] – Set a background color using ANSI escape
  • +
  • tput setb [1-7] – Set a background color
  • +
  • tput setaf [1-7] – Set a foreground color using ANSI escape
  • +
  • tput setf [1-7] – Set a foreground color
  • +
+

Text mode capabilities

    +
  • tput bold – Set bold mode
  • +
  • tput dim – turn on half-bright mode
  • +
  • tput smul – begin underline mode
  • +
  • tput rmul – exit underline mode
  • +
  • tput rev – Turn on reverse mode
  • +
  • tput smso – Enter standout mode (bold on rxvt)
  • +
  • tput rmso – Exit standout mode
  • +
  • tput sgr0 – Turn off all attributes
  • +
+

Color code for tput

    +
  • 0 – Black
  • +
  • 1 – Red
  • +
  • 2 – Green
  • +
  • 3 – Yellow
  • +
  • 4 – Blue
  • +
  • 5 – Magenta
  • +
  • 6 – Cyan
  • +
  • 7 – White
  • +
+
1
printf '\e[48;5;%dm ' {0..255}; printf '\e[0m \n'
+ +
1
2
3
4
5
6
7
8
9
10
11
12
color(){
for c; do
printf '\e[48;5;%dm%03d' $c $c
done
printf '\e[0m \n'
}

IFS=$' \t\n'
# color {0..15}
for ((i=0;i<16;i++)); do
color $(seq $((i*16)) $((i*16+15)))
done
+ +

256 colors of xterm

+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2021/09/25/linux-home-and-end-keys/xterm-256colors.png b/2021/09/25/linux-home-and-end-keys/xterm-256colors.png new file mode 100644 index 00000000..8717cf24 Binary files /dev/null and b/2021/09/25/linux-home-and-end-keys/xterm-256colors.png differ diff --git a/2021/10/01/fused-multiply-add-fma/index.html b/2021/10/01/fused-multiply-add-fma/index.html new file mode 100644 index 00000000..5503c563 --- /dev/null +++ b/2021/10/01/fused-multiply-add-fma/index.html @@ -0,0 +1,253 @@ + + + + + + + + + + + + Fused Multiply-Add (FMA) | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Fused Multiply-Add (FMA) +

+ +

Fused Multiply-Add (FMA)

Introduction

In computing, especially digital signal processing, the multiply-add operation is a common step that computes the product of two numbers and adds that product to an accumulator. The hardware unit that performs the operation is known as a multiplier–accumulator, this operation modifies an accumulator a:

+
  a ← a + ( b × c )
+
+

When done with floating point numbers, it might be performed with two roundings (typical in many DSPs), or with a single rounding. When performed with a single rounding, it is called a fused multiply–add (FMA).

+

In floating-point arithmetic

When done with integers, the operation is typically exact (computed modulo some power of two). However, floating-point numbers have only a certain amount of mathematical precision. That is, digital floating-point arithmetic is generally not associative or distributive. Therefore, it makes a difference to the result whether the multiply–add is performed with two roundings, or in one operation with a single rounding (a fused multiply–add). IEEE 754-2008 specifies that it must be performed with one rounding, yielding a more accurate result.

+

Fused multiply–add

A fused multiply–add (FMA or fmadd) is a floating-point multiply–add operation performed in one step, with a single rounding. That is, where an unfused multiply–add would compute the product b × c, round it to N significant bits, add the result to a, and round back to N significant bits, a fused multiply–add would compute the entire expression a + (b × c) to its full precision before rounding the final result down to N significant bits.

+

A fast FMA can speed up and improve the accuracy of many computations that involve the accumulation of products:

+
    +
  • Dot product
  • +
  • Matrix multiplication
  • +
  • Polynomial evaluation (e.g., with Horner’s rule)
  • +
  • Newton’s method for evaluating functions (from the inverse function)
  • +
  • Convolutions and artificial neural networks
  • +
  • Multiplication in double-double arithmetic
  • +
+

Fused multiply–add can usually be relied on to give more accurate results. However, William Kahan has pointed out that it can give problems if used unthinkingly.

+

When implemented inside a microprocessor, an FMA can be faster than a multiply operation followed by an add.

+

Another benefit of including this instruction is that it allows an efficient software implementation of division and square root operations, thus eliminating the need for dedicated hardware for those operations.

+

Support

The FMA operation is included in IEEE 754-2008. The 1999 standard of the C programming language supports the FMA operation through the fma() standard math library function, and standard pragmas (#pragma STDC FP_CONTRACT) controlling optimizations based on FMA.

+

The fused multiply–add operation was introduced as “multiply–add fused” in the IBM POWER1 (1990) processor, but has been added to numerous other processors since then.

+
    +
  • x86 processors with FMA3 and/or FMA4 instruction set
  • +
  • ARM processors with VFPv4 and/or NEONv2
  • +
  • MIPS processors
  • +
  • IBM z/Architecture
  • +
  • GPUs and GPGPU boards
  • +
  • Vector Processors
  • +
+

Usage

Test program

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
int madd_i(int a, int b, int c) {
return a * b + c;
}

float madd_s(float a, float b, float c) {
return a * b + c;
}

double madd_d(double a, double b, double c) {
return a * b + c;
}

int msub_i(int a, int b, int c) {
return a * b - c;
}

float msub_s(float a, float b, float c) {
return a * b - c;
}

double msub_d(double a, double b, double c) {
return a * b - c;
}
+ +

ARMv8-A

1
2
3
4
aarch64-linux-gnu-gcc -O2 -S -o - test.c

aarch64-linux-gnu-gcc -O2 -Ofast -c test.c && \
aarch64-linux-gnu-objdump -Cw --visualize-jumps -d -S -t test.o
+ +
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
0000000000000000 <madd_i>:
0: 1b010800 madd w0, w0, w1, w2
4: d65f03c0 ret

0000000000000010 <madd_s>:
10: 1f010800 fmadd s0, s0, s1, s2
14: d65f03c0 ret

0000000000000020 <madd_d>:
20: 1f410800 fmadd d0, d0, d1, d2
24: d65f03c0 ret

0000000000000030 <msub_i>:
30: 1b017c00 mul w0, w0, w1
34: 4b020000 sub w0, w0, w2
38: d65f03c0 ret

0000000000000040 <msub_s>:
40: 1f218800 fnmsub s0, s0, s1, s2
44: d65f03c0 ret

0000000000000050 <msub_d>:
50: 1f618800 fnmsub d0, d0, d1, d2
54: d65f03c0 ret
+ +

ARMv7-A

1
2
3
4
arm-linux-gnueabi-gcc -march=armv7-a+neon-vfpv4 -mfloat-abi=hard -O2 -S -o - test.c

arm-linux-gnueabi-gcc -march=armv7-a+neon-vfpv4 -mfloat-abi=hard -Ofast -c test.c && \
arm-linux-gnueabi-objdump -Cw --visualize-jumps -d -S -t test.o
+ +
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
00000000 <madd_i>:
0: e0202091 mla r0, r1, r0, r2
4: e12fff1e bx lr

00000008 <madd_s>:
8: eea01a20 vfma.f32 s2, s0, s1
c: eeb00a41 vmov.f32 s0, s2
10: e12fff1e bx lr

00000014 <madd_d>:
14: eea02b01 vfma.f64 d2, d0, d1
18: eeb00b42 vmov.f64 d0, d2
1c: e12fff1e bx lr

00000020 <msub_i>:
20: e0000091 mul r0, r1, r0
24: e0400002 sub r0, r0, r2
28: e12fff1e bx lr

0000002c <msub_s>:
2c: ee901a20 vfnms.f32 s2, s0, s1
30: eeb00a41 vmov.f32 s0, s2
34: e12fff1e bx lr

00000038 <msub_d>:
38: ee902b01 vfnms.f64 d2, d0, d1
3c: eeb00b42 vmov.f64 d0, d2
40: e12fff1e bx lr
+ +

ARMv6

1
2
3
4
arm-linux-gnueabi-gcc -march=armv6kz -mfloat-abi=hard -mfpu=vfpv2 -O2 -S -o - test.c

arm-linux-gnueabi-gcc -march=armv6kz -mfloat-abi=hard -mfpu=vfpv2 -Ofast -c test.c && \
arm-linux-gnueabi-objdump -Cw --visualize-jumps -d -S -t test.o
+ +
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
00000000 <madd_i>:
0: e0202091 mla r0, r1, r0, r2
4: e12fff1e bx lr

00000008 <madd_s>:
8: ee001a20 vmla.f32 s2, s0, s1
c: eeb00a41 vmov.f32 s0, s2
10: e12fff1e bx lr

00000014 <madd_d>:
14: ee002b01 vmla.f64 d2, d0, d1
18: eeb00b42 vmov.f64 d0, d2
1c: e12fff1e bx lr

00000020 <msub_i>:
20: e0000091 mul r0, r1, r0
24: e0400002 sub r0, r0, r2
28: e12fff1e bx lr

0000002c <msub_s>:
2c: ee101a20 vnmls.f32 s2, s0, s1
30: eeb00a41 vmov.f32 s0, s2
34: e12fff1e bx lr

00000038 <msub_d>:
38: ee102b01 vnmls.f64 d2, d0, d1
3c: eeb00b42 vmov.f64 d0, d2
40: e12fff1e bx lr
+ +

MIPS64

1
2
3
4
mips64el-linux-gnuabi64-gcc -march=mips64r2 -O2 -S -o - test.c

mips64el-linux-gnuabi64-gcc -march=mips64r2 -Ofast -c test.c && \
mips64el-linux-gnuabi64-objdump -Cw --visualize-jumps -d -S -t test.o
+ +
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
0000000000000000 <madd_i>:
0: /-> 70851802 mul v1,a0,a1
4: \-- 03e00008 jr ra
8: 00661021 addu v0,v1,a2

0000000000000010 <madd_s>:
10: 460d6002 mul.s $f0,$f12,$f13
14: 03e00008 jr ra
18: 460e0000 add.s $f0,$f0,$f14

0000000000000020 <madd_d>:
20: 462d6002 mul.d $f0,$f12,$f13
24: 03e00008 jr ra
28: 462e0000 add.d $f0,$f0,$f14

0000000000000030 <msub_i>:
30: 70852002 mul a0,a0,a1
34: 03e00008 jr ra
38: 00861023 subu v0,a0,a2

0000000000000040 <msub_s>:
40: 460d6002 mul.s $f0,$f12,$f13
44: 03e00008 jr ra
48: 460e0001 sub.s $f0,$f0,$f14

0000000000000050 <msub_d>:
50: 462d6002 mul.d $f0,$f12,$f13
54: 03e00008 jr ra
58: 462e0001 sub.d $f0,$f0,$f14
+ +
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# mips64el-linux-gnuabi64-gcc -march=mips64r6 -Ofast -s --freestanding -nostdlib -static -o mips64 mips64.S
# mips64el-linux-gnuabi64-objdump -Cw --visualize-jumps -d -S -t mips64
# qemu-mips64el-static mips64

#include <regdef.h>
#include <asm/unistd.h>

.data
hello_string: .ascii "Hello World!\n"
hello_string_length: .quad . - hello_string

.text
.global __start
__start:
bal 1f
1:
.cpsetup ra, zero, 1b

dli a0, 1
dla a1, hello_string
ld a2, hello_string_length
dli v0, __NR_write
syscall

move a0, zero
dli v0, __NR_exit
syscall
+ +
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
$ qemu-mips64el-static mips64
Hello World!

$ mips64el-linux-gnuabi64-objdump -Cw --visualize-jumps -d -S -t mips64
0000000120000190 <__start>:
120000190: /-- 04110001 bal 120000198 <__start+0x8>
120000194: | 00000000 nop
120000198: \-> 03800025 move zero,gp
12000019c: 3c1c0002 lui gp,0x2
1200001a0: 279c8048 addiu gp,gp,-32696
1200001a4: 039fe02d daddu gp,gp,ra
1200001a8: 24040001 li a0,1
1200001ac: df858020 ld a1,-32736(gp)
1200001b0: df868028 ld a2,-32728(gp)
1200001b4: dcc601e0 ld a2,480(a2)
1200001b8: 24021389 li v0,5001
1200001bc: 0000000c syscall
1200001c0: 00002025 move a0,zero
1200001c4: 240213c2 li v0,5058
1200001c8: 0000000c syscall
1200001cc: 00000000 nop
+ +

PowerPC

1
2
3
4
powerpc64le-linux-gnu-gcc -mcpu=power8 -O2 -S -o - test.c

powerpc64le-linux-gnu-gcc -mcpu=power8 -Ofast -c test.c && \
powerpc64le-linux-gnu-objdump -Cw --visualize-jumps -d -S -t test.o
+ +
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
0000000000000000 <madd_i>:
0: d6 21 63 7c mullw r3,r3,r4
4: 14 2a 63 7c add r3,r3,r5
8: b4 07 63 7c extsw r3,r3
c: 20 00 80 4e blr

0000000000000020 <madd_s>:
20: ba 18 21 ec fmadds f1,f1,f2,f3
24: 20 00 80 4e blr

0000000000000040 <madd_d>:
40: ba 18 21 fc fmadd f1,f1,f2,f3
44: 20 00 80 4e blr

0000000000000060 <msub_i>:
60: d6 21 63 7c mullw r3,r3,r4
64: 50 18 65 7c subf r3,r5,r3
68: b4 07 63 7c extsw r3,r3
6c: 20 00 80 4e blr

0000000000000080 <msub_s>:
80: b8 18 21 ec fmsubs f1,f1,f2,f3
84: 20 00 80 4e blr

00000000000000a0 <msub_d>:
a0: b8 18 21 fc fmsub f1,f1,f2,f3
a4: 20 00 80 4e blr
+ +

RISC-V

1
2
3
4
riscv64-linux-gnu-gcc -march=rv64gc -mabi=lp64d -O2 -S -o - test.c

riscv64-linux-gnu-gcc -march=rv64gc -mabi=lp64d -Ofast -c test.c
riscv64-linux-gnu-objdump -Cw --visualize-jumps -d -S -t test.o
+ +
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
0000000000000000 <madd_i>:
0: /-> 02b5053b mulw a0,a0,a1
4: | 9d31 addw a0,a0,a2
6: \-- 8082 ret

0000000000000008 <madd_s>:
8: 60b57543 fmadd.s fa0,fa0,fa1,fa2
c: 8082 ret

000000000000000e <madd_d>:
e: 62b57543 fmadd.d fa0,fa0,fa1,fa2
12: 8082 ret

0000000000000014 <msub_i>:
14: 02b5053b mulw a0,a0,a1
18: 9d11 subw a0,a0,a2
1a: 8082 ret

000000000000001c <msub_s>:
1c: 60b57547 fmsub.s fa0,fa0,fa1,fa2
20: 8082 ret

0000000000000022 <msub_d>:
22: 62b57547 fmsub.d fa0,fa0,fa1,fa2
26: 8082 ret
+ +

x86_64

1
2
3
4
x86_64-linux-gnu-gcc -march=x86-64-v3 -masm=intel -O2 -S -o - test.c

x86_64-linux-gnu-gcc -march=x86-64-v3 -Ofast -c test.c && \
x86_64-linux-gnu-objdump -Cw --visualize-jumps -d -M intel -S -t test.o
+ +
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
0000000000000000 <madd_i>:
0: 0f af fe imul edi,esi
3: 8d 04 17 lea eax,[rdi+rdx*1]
6: c3 ret

0000000000000010 <madd_s>:
10: c4 e2 69 99 c1 vfmadd132ss xmm0,xmm2,xmm1
15: c3 ret

0000000000000020 <madd_d>:
20: c4 e2 e9 99 c1 vfmadd132sd xmm0,xmm2,xmm1
25: c3 ret

0000000000000030 <msub_i>:
30: 0f af fe imul edi,esi
33: 89 f8 mov eax,edi
35: 29 d0 sub eax,edx
37: c3 ret

0000000000000040 <msub_s>:
40: c4 e2 69 9b c1 vfmsub132ss xmm0,xmm2,xmm1
45: c3 ret

0000000000000050 <msub_d>:
50: c4 e2 e9 9b c1 vfmsub132sd xmm0,xmm2,xmm1
55: c3 ret
+ +

z/Architecture

1
2
3
4
s390x-linux-gnu-gcc -march=z13 -O2 -S -o - test.c

s390x-linux-gnu-gcc -march=z13 -Ofast -c test.c && \
s390x-linux-gnu-objdump -Cw --visualize-jumps -d -S -t test.o
+ +
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
0000000000000000 <madd_i>:
0: b2 52 00 23 msr %r2,%r3
4: 1a 24 ar %r2,%r4
6: b9 14 00 22 lgfr %r2,%r2
a: 07 fe br %r14

0000000000000010 <madd_s>:
10: b3 0e 40 02 maebr %f4,%f0,%f2
14: 28 04 ldr %f0,%f4
16: 07 fe br %r14

0000000000000020 <madd_d>:
20: e7 00 23 08 40 8f wfmadb %v0,%v0,%v2,%v4
26: 07 fe br %r14

0000000000000030 <msub_i>:
30: b2 52 00 23 msr %r2,%r3
34: 1b 24 sr %r2,%r4
36: b9 14 00 22 lgfr %r2,%r2
3a: 07 fe br %r14

0000000000000040 <msub_s>:
40: b3 0f 40 02 msebr %f4,%f0,%f2
44: 28 04 ldr %f0,%f4
46: 07 fe br %r14

0000000000000050 <msub_d>:
50: e7 00 23 08 40 8e wfmsdb %v0,%v0,%v2,%v4
56: 07 fe br %r14
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2022/01/01/freebsd-hypervisor-bhyve/index.html b/2022/01/01/freebsd-hypervisor-bhyve/index.html new file mode 100644 index 00000000..bb541556 --- /dev/null +++ b/2022/01/01/freebsd-hypervisor-bhyve/index.html @@ -0,0 +1,235 @@ + + + + + + + + + + + + FreeBSD Hypervisor: bhyve | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ FreeBSD Hypervisor: bhyve +

+ +

FreeBSD Hypervisor: bhyve

Introduction

The bhyve BSD-licensed hypervisor became part of the base system with FreeBSD 10.0-RELEASE. This hypervisor supports a number of guests, including FreeBSD, OpenBSD, and many Linux® distributions.

+

Preparing the Host

The first step to creating a virtual machine in bhyve is configuring the host system. First, load the bhyve kernel module:

+
1
# kldload vmm
+ +

Then, create a tap interface for the network device in the virtual machine to attach to. In order for the network device to participate in the network, also create a bridge interface containing the tap interface and the physical interface as members. In this example, the physical interface is igb0:

+
1
2
3
4
5
6
7
8
9
10
# ifconfig tap0 create
# sysctl net.link.tap.up_on_open=1
net.link.tap.up_on_open: 0 -> 1
# ifconfig bridge0 create
# ifconfig bridge0 addm ue0 addm tap0
# ifconfig bridge0 up

service bhyve start
service bhyve status
service bhyve stop
+ +

Creating a FreeBSD Guest

Download an installation image of FreeBSD to install:

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# pkg install -y aria2 lzma vm-bhyve bhyve-rc
# pkg info -l aria2 | grep 'bin/'
/usr/local/bin/aria2c
# aria2c -c -m 0 -t 5 -j 8 -s 8 -x 8 -k 1m --file-allocation=falloc https://download.freebsd.org/ftp/releases/ISO-IMAGES/13.1/FreeBSD-13.1-RELEASE-amd64-disc1.iso
Download Results:
gid |stat|avg speed |path/URI
======+====+===========+=======================================================
a31284|OK | 699KiB/s|/root/vm/FreeBSD-13.1-RELEASE-amd64-disc1.iso

# aria2c -c -m 0 -t 5 -j 8 -s 8 -x 8 -k 1m --file-allocation=falloc https://download.freebsd.org/ftp/releases/VM-IMAGES/13.1-RELEASE/amd64/Latest/FreeBSD-13.1-RELEASE-amd64.qcow2.xz
Download Results:
gid |stat|avg speed |path/URI
======+====+===========+=======================================================
0ed032|OK | 1.2MiB/s|/root/vm/FreeBSD-13.1-RELEASE-amd64.qcow2.xz

# xz -d -k -v FreeBSD-13.1-RELEASE-amd64.qcow2.xz

# fetch https://download.freebsd.org/ftp/releases/ISO-IMAGES/13.1/FreeBSD-13.1-RELEASE-amd64-disc1.iso
# fetch https://download.freebsd.org/ftp/releases/VM-IMAGES/13.1-RELEASE/amd64/Latest/FreeBSD-13.1-RELEASE-amd64.qcow2.xz
+ +

Create a file to use as the virtual disk for the guest machine. Specify the size and name of the virtual disk:

+
1
# truncate -s 16G guest.img
+ +

FreeBSD comes with an example script for running a virtual machine in bhyve. The script will start the virtual machine and run it in a loop, so it will automatically restart if it crashes. The script takes a number of options to control the configuration of the machine

+

This example starts the virtual machine in installation mode:

+
1
# sh /usr/share/examples/bhyve/vmrun.sh -c 2 -m 1024M -t tap0 -d guest.img -i -I FreeBSD-13.1-RELEASE-amd64-disc1.iso guestname
+ +

The virtual machine will boot and start the installer. After installing a system in the virtual machine, when the system asks about dropping in to a shell at the end of the installation, choose Yes.

+

Reboot the virtual machine. While rebooting the virtual machine causes bhyve to exit, the vmrun.sh script runs bhyve in a loop and will automatically restart it. When this happens, choose the reboot option from the boot loader menu in order to escape the loop. Now the guest can be started from the virtual disk:

+
1
# sh /usr/share/examples/bhyve/vmrun.sh -c 2 -m 1024M -t tap0 -d guest.img guestname
+ +

Managing Virtual Machines

A device node is created in /dev/vmm for each virtual machine. This allows the administrator to easily see a list of the running virtual machines:

+
1
# ls -al /dev/vmm
+ +

A specified virtual machine can be destroyed using bhyvectl:

+
1
# bhyvectl --destroy --vm=guestname
+ +

Persistent Configuration

In order to configure the system to start bhyve guests at boot time, the following configurations must be made in the specified files:

+
    +
  1. /etc/sysctl.conf

    +
    1
    net.link.tap.up_on_open=1
    +
  2. +
  3. /etc/rc.conf

    +
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    hostname="freebsd-amd64-01"
    ifconfig_DEFAULT="DHCP"
    ipv6_enable="YES"
    ipv6_activate_all_interfaces="YES"
    sshd_enable="YES"
    ntpdate_enable="YES"
    sendmail_enable="NONE"
    sendmail_submit_enable="NO"
    sendmail_outbound_enable="NO"
    sendmail_msp_queue_enable="NO"
    growfs_enable="YES"

    cloned_interfaces="tap0 tap1 bridge0"
    ifconfig_bridge0="addm ue0 addm tap0 addm tap1"

    kld_list="nmdm vmm"

    bhyve_enable="YES"
    bhyve_profiles="virt1 virt2"
    bhyve_virt1_diskdev="/dev/zvol/tank/bhyve/virt1"
    bhyve_virt2_tapdev="tap1"
    bhyve_virt2_diskdev="/dev/zvol/tank/bhyve/virt2"
    bhyve_virt2_memsize="8192"
    bhyve_virt2_ncpu="4"

    vm_enable="YES"
    #vm_dir="zfs:pool/bhyve/virt"
    vm_dir="/var/bhyve/virt"
  4. +
+

Reference

+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2022/11/06/compiling-the-linux-kernel-for-wsl2/index.html b/2022/11/06/compiling-the-linux-kernel-for-wsl2/index.html new file mode 100644 index 00000000..5bde153a --- /dev/null +++ b/2022/11/06/compiling-the-linux-kernel-for-wsl2/index.html @@ -0,0 +1,220 @@ + + + + + + + + + + + + Compiling the Linux Kernel for WSL2 | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Compiling the Linux Kernel for WSL2 +

+ +

Compiling the Linux Kernel for WSL2

WSL2 architecture

WSL 2 not only loads a native Linux Kernel, the image of the Linux Kernel is in the directory C:\Windows\System32\lxss\tools, but it also gives us the option of loading a customized Linux kernel. That’s right, we can compile and customize our own kernel to be loaded into WSL 2.

+

WSL2 architecture

+

Preparation

Start build container

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1

sudo podman run --rm -it --pull always -h debian-stable \
-w /root -v $(pwd):/xyz --network=host \
-e "PATH=/usr/sbin:/usr/bin:/sbin:/bin" \
-e NO_PROXY="localhost,::1/128,f000::/4,127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16" \
public.ecr.aws/docker/library/debian:stable

echo "precedence ::ffff:0:0/96 100" >> /etc/gai.conf; \
apt-get update && apt-get dist-upgrade -y && \
apt-get install -y whiptail && \
apt-get install -y bc bison build-essential curl dwarves file flex \
git less libelf-dev libncurses-dev libssl-dev procps \
python3 python3-pip python3-psutil python3-virtualenv \
vim-tiny zstd
+ +

Use WSL2 Linux Kernel

1
2
3
4
5
6
7
8
9
10
11
# time git clone --depth 100 -b linux-msft-wsl-6.6.y https://github.com/microsoft/WSL2-Linux-Kernel.git
...
real 2m55.718s
user 1m36.683s
sys 0m16.305s

# du -ms WSL2-Linux-Kernel/
2041 WSL2-Linux-Kernel/

# cd WSL2-Linux-Kernel/ && git describe --tags
linux-msft-wsl-6.6.36.3
+ + +

Use Stable Linux Kernel

1
2
3
4
5
6
rm -fr ~/Linux-6.x/Microsoft && mkdir -p $_ && cd $_/..
curl -sSL https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.9.10.tar.xz | tar --strip-components=1 -xJ -f -
curl -sSL -o arch/x86/configs/config-wsl https://raw.githubusercontent.com/microsoft/WSL2-Linux-Kernel/linux-msft-wsl-6.6.y/arch/x86/configs/config-wsl

# du -ms
1570 .
+ +

Make Configure

We can turn on certain Linux kernel features as needed, which is also the value of compiling the kernel ourselves.

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
cat << EOF >> arch/x86/configs/config-wsl

# Processor type and features/vsyscall table for legacy applications/Emulate execution only
CONFIG_LEGACY_VSYSCALL_XONLY=y

# Compile-time checks and compiler options
# BTF: .tmp_vmlinux.btf: pahole (pahole) is not available
# BTF = BPF Type Format, Use BTF in BPF rograms
# http://vger.kernel.org/~acme/perf/btf-perf-pahole-lsfmm-san-juan-2019/
# CONFIG_DEBUG_INFO_BTF=y
# CONFIG_DEBUG_INFO_BTF_MODULES=y

CONFIG_PREEMPT_DYNAMIC=y
CONFIG_PREEMPT_RCU=y

CONFIG_KVM=y
CONFIG_KVM_INTEL=y
CONFIG_KVM_AMD=y

CONFIG_TLS=y
CONFIG_IP_SCTP=y

CONFIG_CRYPTO_ZSTD=y
CONFIG_KERNEL_ZSTD=y
CONFIG_MODULE_COMPRESS_ZSTD=y
CONFIG_SQUASHFS_ZSTD=y

# Enable the block layer/ Partition Types/Advanced partition selection
CONFIG_BSD_DISKLABEL=y

# Device Drivers/Block devices
CONFIG_ATA_OVER_ETH=y
CONFIG_BLK_DEV_NBD=y
CONFIG_BLK_DEV_RBD=y
CONFIG_BLK_DEV_UBLK=y
CONFIG_ZRAM=y

# File systems/Miscellaneous filesystems
CONFIG_BTRFS_FS=y
CONFIG_ECRYPT_FS=y
CONFIG_FUSE_FS=y
CONFIG_HFS_FS=y
CONFIG_HFSPLUS_FS=y
CONFIG_UFS_FS=y
CONFIG_UFS_FS_WRITE=y

# File systems/Network File Systems
CONFIG_CIFS=y
CONFIG_NFS_DISABLE_UDP_SUPPORT=y
CONFIG_NFS_V4_2=y
CONFIG_NFS_V4_2_READ_PLUS=y

CONFIG_SUNRPC=y
CONFIG_SUNRPC_BACKCHANNEL=y
CONFIG_SUNRPC_GSS=y
CONFIG_RPCSEC_GSS_KRB5=y
CONFIG_RPCSEC_GSS_KRB5_ENCTYPES_AES_SHA2=y
EOF
+ +
1
2
3
4
scripts/config --file arch/x86/configs/config-wsl --disable SYSTEM_REVOCATION_KEYS; \
scripts/config --file arch/x86/configs/config-wsl --disable SYSTEM_TRUSTED_KEYRING

make KCONFIG_CONFIG=arch/x86/configs/config-wsl menuconfig
+ +

Make Kernel

WSL2 Linux Kernel

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# time make KCONFIG_CONFIG=arch/x86/configs/config-wsl -j8 bzImage
...
real 19m6.172s
user 135m7.511s
sys 17m11.616s

# du -ks arch/x86/boot/bzImage
15620 arch/x86/boot/bzImage

# du -ms .
6024 .

# cp arch/x86/boot/bzImage /mnt/c/Users/<seuUser>/vmlinuz-6.6.36.3-WSL2
# cp arch/x86/configs/config-wsl /mnt/c/Users/<seuUser>/vmlinuz-6.6.36.3-WSL2.config
# vi /mnt/c/Users/<seuUser>/.wslconfig

time make KCONFIG_CONFIG=arch/x86/configs/config-wsl -j8 modules
time make KCONFIG_CONFIG=arch/x86/configs/config-wsl -j8 tarxz-pkg
+ +

Stable Linux Kernel

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# time make KCONFIG_CONFIG=arch/x86/configs/config-wsl -j8 bzImage
...
Kernel: arch/x86/boot/bzImage is ready (#1)

real 19m57.919s
user 142m41.987s
sys 12m48.108s

# du -ms .
4467 .

# du -ks arch/x86/boot/bzImage
13992 arch/x86/boot/bzImage

# cp arch/x86/boot/bzImage /mnt/c/Users/<seuUser>/vmlinuz-6.9.10-WSL2
# cp arch/x86/configs/config-wsl /mnt/c/Users/<seuUser>/vmlinuz-6.9.10-WSL2.config
# vi /mnt/c/Users/<seuUser>/.wslconfig

time make KCONFIG_CONFIG=arch/x86/configs/config-wsl -j8 modules
time make KCONFIG_CONFIG=arch/x86/configs/config-wsl -j8 tarxz-pkg
+ +

Update %UserProfile%.wslconfig

+
1
2
3
4
5
6
7
8
9
[wsl2]
# An absolute Windows path to a custom Linux kernel
# kernel=C:\\Users\\<seuUser>\\vmlinuz-6.6.36.3-WSL2
# kernel=C:\\Users\\<seuUser>\\vmlinuz-6.9.10-WSL2
# 50% of total memory on Windows or 8GB, whichever is less
# memory=8GB
# Sets additional kernel parameters, in this case enabling older Linux base images such as Centos 6
# kernelCommandLine = vsyscall=emulate systemd.unified_cgroup_hierarchy=1 cgroup_no_v1=all
# kernelCommandLine = vsyscall=emulate systemd.unified_cgroup_hierarchy=1 cgroup_no_v1=named
+ +

Restart WSL2

1
2
3
4
5
wsl --version
wsl --list --verbose
wsl --shutdown

# taskkill /F /T /IM wslservice.exe
+ +
1
wsl
+ +

Check WSL2

WSL2 Linux Kernel

1
2
# cat /proc/version
Linux version 6.6.36.3-microsoft-standard-WSL2+ (root@debian-stable) (gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40) #1 SMP PREEMPT_DYNAMIC Fri Jul 19 07:04:59 UTC 2024
+ +

Stable Linux Kernel

1
2
# cat /proc/version
Linux version 6.9.10-microsoft-standard-WSL2 (root@debian-stable) (gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40) #1 SMP PREEMPT_DYNAMIC Fri Jul 19 02:25:29 UTC 2024
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2022/11/06/compiling-the-linux-kernel-for-wsl2/wsl2-architecture.png b/2022/11/06/compiling-the-linux-kernel-for-wsl2/wsl2-architecture.png new file mode 100644 index 00000000..3ff7df30 Binary files /dev/null and b/2022/11/06/compiling-the-linux-kernel-for-wsl2/wsl2-architecture.png differ diff --git a/2023/02/04/console-based-gmail-client/index.html b/2023/02/04/console-based-gmail-client/index.html new file mode 100644 index 00000000..320e67eb --- /dev/null +++ b/2023/02/04/console-based-gmail-client/index.html @@ -0,0 +1,232 @@ + + + + + + + + + + + + Console Based Gmail Client | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Console Based Gmail Client +

+ +

Console Based Gmail Client

+

Incoming Mail (IMAP) Server

1
2
3
imap.gmail.com
Requires SSL: Yes
Port: 993
+ +

Outgoing Mail (SMTP) Server

1
2
3
4
5
6
smtp.gmail.com
Requires SSL: Yes
Port for SSL: 465
Requires TLS: Yes
Port for TLS/STARTTLS: 587
Requires Authentication: Yes
+ +
1
2
openssl s_client -connect smtp.gmail.com:465 -crlf
openssl s_client -connect smtp.gmail.com:587 -crlf -starttls smtp
+ +
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# msmtp -S --host=smtp.gmail.com --port=465 --tls=on --tls-starttls=off
# msmtp -S --host=smtp.gmail.com --port=587 --tls=on --tls-starttls=on
SMTP server at smtp.gmail.com (bi-in-f109.1e100.net [2607:f8b0:4004:c08::6d]), port 587:
smtp.gmail.com ESMTP 16-20020a05620a041000b007201df7ff47sm11422373qkp.45 - gsmtp
TLS session parameters:
(TLS1.3)-(ECDHE-X25519)-(ECDSA-SECP256R1-SHA256)-(AES-256-GCM)
TLS certificate information:
Subject:
CN=smtp.gmail.com
Issuer:
C=US,O=Google Trust Services LLC,CN=GTS CA 1C3
Validity:
Activation time: Mon 09 Jan 2023 04:18:39 PM CST
Expiration time: Mon 03 Apr 2023 04:18:38 PM CST
Fingerprints:
SHA256: 46:22:44:D3:E5:6D:94:A5:CE:18:AE:DB:E2:30:05:82:B5:18:0D:10:3C:B3:53:B2:DC:3D:AD:1F:A2:1A:43:97
SHA1 (deprecated): 23:D7:F1:24:51:BE:47:68:6D:2A:2C:28:37:A8:8E:1A:53:41:F9:70
Capabilities:
SIZE 35882577:
Maximum message size is 35882577 bytes = 34.22 MiB
PIPELINING:
Support for command grouping for faster transmission
STARTTLS:
Support for TLS encryption via the STARTTLS command
AUTH:
Supported authentication methods:
PLAIN LOGIN OAUTHBEARER XOAUTH2
+ +

Mail Transfer Agent (MTA)

dma

1
2
vi /etc/dma/auth.conf
me@gmail.com|smtp.gmail.com:PaSsWorD
+ +
1
2
3
4
5
vi /etc/dma/dma.conf
AUTHPATH /etc/dma/auth.conf
SECURETRANSFER
SMARTHOST smtp.gmail.com
PORT 465
+ +
1
2
3
4
5
6
vi /etc/dma/dma.conf
AUTHPATH /etc/dma/auth.conf
SECURETRANSFER
SMARTHOST smtp.gmail.com
PORT 587
STARTTLS
+ +
1
2
3
4
5
6
7
8
9
10
11
12
13
cat << EOF | dma -D it@gmail.com
From: me <me@gmail.com>
To: it <it@gmail.com>
Subject: title
Content-Type: text/plain; charset="UTF-8"

Hi,

Sent from dma #1.

Thanks,
me
EOF
+ +

msmtp

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
vi ~/.msmtprc

account default
auth on
tls on
logfile ~/.msmtp.log

host smtp.gmail.com
from me@gmail.com

user me@gmail.com
password PaSsWorD
# gpg -vv --encrypt -o ~/.msmtp-password.gpg -r me@gmail.com -
# gpg -c -vv --cipher-algo AES256 -o ~/.msmtp-password.gpg -
# passwordeval gpg --no-tty -q -d ~/.msmtp-password.gpg

# port 465
# tls_starttls off

port 587
tls_starttls on
+ +
1
2
3
4
5
6
7
8
9
10
11
12
13
cat << EOF | msmtp -v it@gmail.com
From: me <me@gmail.com>
To: me <it@gmail.com>
Subject: title
Content-Type: text/plain; charset="UTF-8"

Hi,

Sent from msmtp #1.

Thanks,
me
EOF
+ +

ssmtp

1
2
3
4
vi /etc/ssmtp/revaliases

# Format: local_account:outgoing_address:mailhub
root:me@gmail.com:smtp.gmail.com:465
+ +
1
2
3
4
5
6
7
8
9
10
11
vi /etc/ssmtp/ssmtp.conf
chmod 0666 /etc/ssmtp/ssmtp.conf

FromLineOverride yes
Mailhub smtp.gmail.com:465
UseTLS=YES
#Mailhub smtp.gmail.com:587
#UseSTARTTLS=YES
AuthMethod=LOGIN
AuthUser=me@gmail.com
AuthPass=PaSsWorD
+ +
1
2
3
4
5
6
7
8
9
10
11
12
13
cat << EOF | ssmtp -v it@gmail.com
From: me <me@gmail.com>
To: me <it@gmail.com>
Subject: title
Content-Type: text/plain; charset="UTF-8"

Hi,

Sent from ssmtp #1.

Thanks,
me
EOF
+ +

Mail Delivery Agent (MDA)

+

fetchmail

1
2
3
4
5
PATH=/usr/bin:/usr/ucb:/bin:/usr/local/bin:.
MAILDIR=$HOME/Mail # You'd better make sure it exists
DEFAULT=$MAILDIR/mbox
LOGFILE=$MAILDIR/log
LOCKFILE=$HOME/.lock
+ +
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
touch ~/.fetchmailrc && chmod 600 $_

vi ~/.fetchmail.rc

poll imap.gmail.com service 993 protocol IMAP
username "me@gmail.com"
password "PaSsWorD"
options ssl sslproto TLS1.2+
mimedecode keep fetchlimit 100
mda "/usr/bin/procmail -f %F -d %T"


/etc/default/fetchmail
/etc/init.d/fetchmail
/etc/logcheck/ignore.d.server/fetchmail
/etc/logcheck/ignore.d.workstation/fetchmail
/etc/ppp/ip-down.d/fetchmail
/etc/ppp/ip-up.d/fetchmail
/etc/resolvconf/update-libc.d/fetchmail
/usr/lib/systemd/user/fetchmail.service
/usr/share/doc/fetchmail/examples/fetchmailrc.example
+ +
1
fetchmail -f ~/.fetchmail.rc --verbose
+ +

Mail User Agent (MUA)

mutt

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
vi ~/.muttrc

set my_user = "me@gmail.com"
# gpg -vv --encrypt -o ~/.mutt-password.gpg -r me@gmail.com -
# gpg -c -vv --cipher-algo AES256 -o ~/.mutt-password.gpg -
# set my_pass = "PaSsWorD"
source "gpg -dq $HOME/.mutt-password.gpg |"

set realname = "me"
# set signature="path/to/sig/file" # ~/.signature
set from = $my_user
set use_from = yes
set send_charset="utf-8"
set sort = threads

set mbox_type=Maildir
set date_format="%y-%m-%d %T"
set index_format="%2C | %Z [%d] %-30.30F (%-4.4c) %s"

# type ‘c’ to change to another folder
set folder = imaps://imap.gmail.com/
set spoolfile = +INBOX
set postponed = +[Gmail]/Drafts
set trash = "+[Gmail]/Trash"
# Gmail automatically saves sent e-mail to +[Gmail]/Sent, so we do not want duplicates.
# set record = +[Gmail]/Sent
unset record
set imap_user=$my_user
set imap_pass=$my_pass
set imap_check_subscribed
set imap_keepalive = 300
unset imap_passive
set mail_check = 60

set smtp_url=smtps://$my_user:$my_pass@smtp.gmail.com

# set sendmail="/usr/bin/msmtp"
# set sendmail="/usr/sbin/dma"
# set sendmail="/usr/sbin/ssmtp"
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2023/02/11/gtk-user-configuration/index.html b/2023/02/11/gtk-user-configuration/index.html new file mode 100644 index 00000000..6b287eeb --- /dev/null +++ b/2023/02/11/gtk-user-configuration/index.html @@ -0,0 +1,201 @@ + + + + + + + + + + + + GTK User Configuration | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ GTK User Configuration +

+ +

GTK User Configuration

+

GTK 2

GIMP (2.10.32) is the only useful GUI program that still uses GTK 2.

+
1
2
3
4
5
6
7
8
9
10
11
# vi ~/.gtkrc-2.0
# libgtk2.0-0 (2.24.33)

gtk-icon-theme-name = Adwaita
# gtk-cursor-theme-size = 16
gtk-font-name = "sans-serif 16"
# GTK+ itself use the following named icon sizes: gtk-menu, gtk-button, gtk-small-toolbar, gtk-large-toolbar, gtk-dnd, gtk-dialog.
gtk-icon-sizes = "panel-menu=16,16:panel=16,16:gtk-menu=16,16:gtk-large-toolbar=16,16:gtk-small-toolbar=16,16:gtk-button=16,16"
# gtk-icon-theme-name = "Tangerine"
gtk-theme-name = Greybird
gtk-key-theme-name = Emacs
+ +

GTK 3

Most gnome programs now use GTK 3.

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# mkdir -p  ~/.config/gtk-3.0/ && vi ~/.config/gtk-3.0/settings.ini
# libgtk-3-0 (3.24.36)

[Settings]
gtk-cursor-theme-name = Adwaita
gtk-cursor-theme-size = 16

gtk-font-name = sans-serif 16
# gtk-font-name = Consolas 16

# GTK+ itself use the following named icon sizes: gtk-menu, gtk-button, gtk-small-toolbar, gtk-large-toolbar, gtk-dnd, gtk-dialog.
gtk-icon-sizes = panel-menu=16,16:panel=16,16:gtk-menu=16,16:gtk-large-toolbar=16,16:gtk-small-toolbar=16,16:gtk-button=16,16
gtk-icon-theme-name = Adwaita
gtk-theme-name = Greybird
gtk-key-theme-name = Emacs
+ +

GTK 4

Only a few gnome programs use GTK 4 today.

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# mkdir -p  ~/.config/gtk-4.0/ && vi ~/.config/gtk-4.0/settings.ini
# libgtk-4-1 (4.8.3)

[Settings]
gtk-cursor-theme-name = Adwaita
gtk-cursor-theme-size = 16

gtk-font-name = sans-serif 16
# gtk-font-name = Consolas 16

# GTK+ itself use the following named icon sizes: gtk-menu, gtk-button, gtk-small-toolbar, gtk-large-toolbar, gtk-dnd, gtk-dialog.
gtk-icon-sizes = panel-menu=16,16:panel=16,16:gtk-menu=16,16:gtk-large-toolbar=16,16:gtk-small-toolbar=16,16:gtk-button=16,16
gtk-icon-theme-name = Adwaita
gtk-theme-name = Greybird
gtk-key-theme-name = Emacs
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2023/02/12/run-linux-gui-programs-with-wslg-through-oci-image/index.html b/2023/02/12/run-linux-gui-programs-with-wslg-through-oci-image/index.html new file mode 100644 index 00000000..66bd04a0 --- /dev/null +++ b/2023/02/12/run-linux-gui-programs-with-wslg-through-oci-image/index.html @@ -0,0 +1,307 @@ + + + + + + + + + + + + Run Linux GUI Programs With WSLg Through OCI Image | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Run Linux GUI Programs With WSLg Through OCI Image +

+ +

Run Linux GUI Programs With WSLg Through OCI Image

+

Install WSL2

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
PS C:\> wsl --list --online
The following is a list of valid distributions that can be installed.
Install using 'wsl.exe --install <Distro>'.

NAME FRIENDLY NAME
Ubuntu Ubuntu
Debian Debian GNU/Linux
kali-linux Kali Linux Rolling
Ubuntu-18.04 Ubuntu 18.04 LTS
Ubuntu-20.04 Ubuntu 20.04 LTS
Ubuntu-22.04 Ubuntu 22.04 LTS
OracleLinux_8_5 Oracle Linux 8.5
OracleLinux_7_9 Oracle Linux 7.9
SUSE-Linux-Enterprise-Server-15-SP4 SUSE Linux Enterprise Server 15 SP4
openSUSE-Leap-15.4 openSUSE Leap 15.4
openSUSE-Tumbleweed openSUSE Tumbleweed

PS C:\> wsl --install Debian
PS C:\> wsl --install Ubuntu
PS C:\> wsl --install Ubuntu-22.04
PS C:\> wsl --install openSUSE-Leap-15.4
+ +

Attaches and mounts disk in all WSL2 distributions

Create Virtual Disk

1
2
3
4
5
qemu-img create -f qcow2 -o compression_type=zstd share-disk.qcow2 64G
qemu-img info share-disk.qcow2

qemu-img create -f vhdx share-disk.vhdx 64G
qemu-img info share-disk.vhdx
+ + +

Mount Virtual Disk - Windows

1
2
3
wsl --unmount share-disk.vhdx

wsl --mount --vhd share-disk.vhdx
+ +

Mount Virtual Disk - Linux

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# gdisk -l /dev/sde
GPT fdisk (gdisk) version 1.0.8

Partition table scan:
MBR: not present
BSD: not present
APM: not present
GPT: not present

Creating new GPT entries in memory.
Disk /dev/sde: 2147483648 sectors, 1024.0 GiB
Model: Virtual Disk
Sector size (logical/physical): 512/4096 bytes
Disk identifier (GUID): B38F5AE6-9ED7-4C65-9F21-6A9206A5AD7D
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 2147483614
Partitions will be aligned on 2048-sector boundaries
Total free space is 2147483581 sectors (1024.0 GiB)

Number Start (sector) End (sector) Size Code Name
+ +
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# mount /dev/sde /mnt/Debian-12-ext4
# cd /mnt/Debian-12-ext4
# ls -ln
total 76
lrwxrwxrwx 1 0 0 7 Feb 8 13:00 bin -> usr/bin
drwxr-xr-x 2 0 0 4096 Oct 3 21:30 boot
drwxr-xr-x 2 0 0 4096 Feb 8 13:00 dev
drwxr-xr-x 29 0 0 4096 Feb 12 08:53 etc
drwxr-xr-x 2 0 0 4096 Oct 3 21:30 home
-rwxr-xr-x 1 0 0 0 Feb 12 08:53 init
lrwxrwxrwx 1 0 0 7 Feb 8 13:00 lib -> usr/lib
lrwxrwxrwx 1 0 0 9 Feb 8 13:00 lib32 -> usr/lib32
lrwxrwxrwx 1 0 0 9 Feb 8 13:00 lib64 -> usr/lib64
lrwxrwxrwx 1 0 0 10 Feb 8 13:00 libx32 -> usr/libx32
drwx------ 2 0 0 16384 Feb 12 08:53 lost+found
drwxr-xr-x 2 0 0 4096 Feb 8 13:00 media
drwxr-xr-x 5 0 0 4096 Feb 12 08:53 mnt
drwxr-xr-x 2 0 0 4096 Feb 8 13:00 opt
drwxr-xr-x 2 0 0 4096 Oct 3 21:30 proc
drwx------ 2 0 0 4096 Feb 12 08:54 root
drwxr-xr-x 3 0 0 4096 Feb 8 13:00 run
lrwxrwxrwx 1 0 0 8 Feb 8 13:00 sbin -> usr/sbin
drwxr-xr-x 2 0 0 4096 Feb 8 13:00 srv
drwxr-xr-x 2 0 0 4096 Oct 3 21:30 sys
drwxrwxrwt 3 0 0 4096 Feb 12 08:53 tmp
drwxr-xr-x 14 0 0 4096 Feb 8 13:00 usr
drwxr-xr-x 11 0 0 4096 Feb 8 13:00 var

# dmesg
...
[ 3286.554788] scsi 0:0:0:4: Direct-Access Msft Virtual Disk 1.0 PQ: 0 ANSI: 5
[ 3286.558599] sd 0:0:0:4: Attached scsi generic sg4 type 0
[ 3286.559426] sd 0:0:0:4: [sde] 2147483648 512-byte logical blocks: (1.10 TB/1.00 TiB)
[ 3286.560482] sd 0:0:0:4: [sde] 4096-byte physical blocks
[ 3286.561402] sd 0:0:0:4: [sde] Write Protect is off
[ 3286.562124] sd 0:0:0:4: [sde] Mode Sense: 0f 00 00 00
[ 3286.563161] sd 0:0:0:4: [sde] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[ 3286.565743] sd 0:0:0:4: [sde] Attached SCSI disk
[ 3286.578015] WSL (397): Detected ext4 filesystem for device: /dev/sde
[ 3286.614048] EXT4-fs (sde): mounted filesystem with ordered data mode. Quota mode: none.
+ +

Debian 12

Import Debian Image

1
2
3
curl -L -o debian-minirootfs-12-x86_64.tar.gz https://github.com/debuerreotype/docker-debian-artifacts/raw/dist-amd64/bookworm/rootfs.tar.xz
wsl --import Debian-12 . debian-minirootfs-12-x86_64.tar.gz
wsl -d Debian-12
+ +

Setup Debian

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
libsystemd0-249.14-150400.8.19.1.x86_64
/usr/lib64/libsystemd.so.0
/usr/lib64/libsystemd.so.0.32.0

systemd-249.14-150400.8.19.1.x86_64
/bin/systemctl
/usr/bin/bootctl
/usr/bin/busctl
/usr/bin/hostnamectl
/usr/bin/journalctl
/usr/bin/kernel-install
/usr/bin/localectl
/usr/bin/loginctl
/usr/bin/systemctl
/usr/bin/timedatectl
util-linux-systemd-2.37.2-150400.8.14.1.x86_64
/usr/bin/logger
/usr/bin/lslogins

cat << EOF | tee /etc/wsl.conf
[boot]
systemd=true

[network]
generateResolvConf = false
EOF

rm -fr /etc/resolv.conf && cat << EOF | tee /etc/resolv.conf
nameserver 193.181.14.10
nameserver 193.181.14.11
nameserver 193.181.14.12
EOF

chattr +iS /etc/resolv.conf
+ +
1
2
3
4
5
6
7
8
9
10
11
12
cat << EOF | tee ~/.vimrc
set ignorecase
set nocompatible
set showcmd

syntax on
set nowrap
set autoindent
set nu
set paste
set mouse-=a
EOF
+ +
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
apt update && apt upgrade -y --no-install-recommends; \
apt install -y --no-install-recommends locales whiptail

dpkg-reconfigure locales

apt install -y --no-install-recommends \
adwaita-icon-theme \
at-spi2-core \
ca-certificates \
emacs-gtk \
gedit \
greybird-gtk-theme \
librsvg2-2 \
mesa-utils \
ukui-themes \
vim-gtk3 \
wayland-utils \
weston
+ +

Font Configuration

Let’s add the Windows fonts & disabling bitmap fonts first.

+
1
fc-list ':' file | sort
+ +
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
vi /etc/fonts/fonts.conf

<!-- add Windows fonts -->
<dir>/mnt/c/Windows/Fonts/</dir>

<dir>/usr/share/fonts</dir>
<dir prefix="xdg">fonts</dir>

<cachedir>/var/cache/fontconfig</cachedir>
<cachedir prefix="xdg">fontconfig</cachedir>


<selectfont>
<rejectfont>
<pattern>
<patelt name="scalable"><bool>false</bool></patelt>
</pattern>
</rejectfont>
</selectfont>
+ +
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<?xml version="1.0"?>
<!--
vi /etc/fonts/fonts.conf
XMLLINT_INDENT=" " xmllint \-\-format /etc/fonts/fonts.conf
https://www.freedesktop.org/software/fontconfig/fontconfig-user.html
-->
<fontconfig>
<dir>/usr/share/fonts</dir>
<dir prefix="xdg">fonts</dir>
<dir>/mnt/c/Windows/Fonts/</dir>

<cachedir>/var/cache/fontconfig</cachedir>
<cachedir prefix="xdg">fontconfig</cachedir>

<config>
<rescan>
<int>30</int>
</rescan>
</config>

<selectfont>
<rejectfont>
<pattern>
<patelt name="scalable">
<bool>false</bool>
</patelt>
</pattern>
</rejectfont>
</selectfont>

<match target="pattern">
<test qual="any" name="family">
<string>mono</string>
</test>
<edit name="family" mode="assign">
<string>monospace</string>
</edit>
</match>

<match target="pattern">
<test qual="any" name="family">
<string>sans</string>
</test>
<edit name="family" mode="assign" binding="same">
<string>sans-serif</string>
</edit>
</match>

<match target="pattern">
<test qual="any" name="family">
<string>sans serif</string>
</test>
<edit name="family" mode="assign" binding="same">
<string>sans-serif</string>
</edit>
</match>

<match target="pattern">
<test qual="all" name="family" compare="not_eq">
<string>sans-serif</string>
</test>
<test qual="all" name="family" compare="not_eq">
<string>serif</string>
</test>
<test qual="all" name="family" compare="not_eq">
<string>monospace</string>
</test>
<edit name="family" mode="append_last">
<string>sans-serif</string>
</edit>
</match>

<match target="font" >
<edit mode="assign" name="autohint"> <bool>false</bool></edit>
<edit mode="assign" name="hinting"> <bool>true</bool></edit>
<edit mode="assign" name="hintstyle"> <const>hintslight</const></edit>
<edit mode="assign" name="antialias"> <bool>true</bool></edit>
<edit mode="assign" name="lcdfilter"> <const>lcddefault</const></edit>
<edit mode="assign" name="rgba"> <const>rgb</const></edit>
</match>

<alias>
<family>sans-serif</family>
<prefer>
<family>Helvetica</family>
<family>Myriad Pro</family>
<family>Calibri</family>
<family>Verdana</family>
<family>Adobe Pi Std</family>
<family>Symbol Std</family>
<family>Cambria Math</family>
<family>Microsoft YaHei Light</family>
<family>Microsoft JhengHei Light</family>
<family>SimHei</family>
<family>NSimSun</family>
<family>SimSun-ExtB</family>
<family>Adobe Fan Heiti Std</family>
<family>Adobe Heiti Std</family>
</prefer>
</alias>

<alias>
<family>serif</family>
<prefer>
<family>Times New Roman</family>
<family>Minion Pro</family>
<family>Cambria</family>
<family>Georgia</family>
<family>Adobe Pi Std</family>
<family>Symbol Std</family>
<family>Cambria Math</family>
<family>Microsoft YaHei Light</family>
<family>Microsoft JhengHei Light</family>
<family>NSimSun</family>
<family>SimSun\-ExtB</family>
<family>Adobe Ming Std</family>
<family>Adobe Song Std</family>
</prefer>
</alias>

<alias>
<family>monospace</family>
<prefer>
<family>JetBrains Mono</family>
<family>Consolas</family>
<family>Courier Std</family>
<family>Courier New</family>
<family>Adobe Pi Std</family>
<family>Symbol Std</family>
<family>Cambria Math</family>
<family>Microsoft YaHei Light</family>
<family>Microsoft JhengHei Light</family>
<family>NSimSun</family>
<family>SimSun-ExtB</family>
<family>Adobe Ming Std</family>
<family>Adobe Song Std</family>
</prefer>
</alias>
</fontconfig>
+ +
1
2
3
4
5
fc-cache -rv

fc-match -s 'monospace' | head
fc-match -s 'serif' | head
fc-match -s 'sans-serif' | head
+ +

Wayland Information

1
glxinfo -B
+ +
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# wayland-info || weston-info
interface: 'wl_compositor', version: 4, name: 1
interface: 'wl_subcompositor', version: 1, name: 2
interface: 'wp_viewporter', version: 1, name: 3
interface: 'zxdg_output_manager_v1', version: 2, name: 4
xdg_output_v1
output: 21
name: 'rdp-2'
logical_x: 1920, logical_y: 0
logical_width: 1920, logical_height: 1080
xdg_output_v1
output: 11
name: 'rdp-0'
logical_x: 0, logical_y: 0
logical_width: 1920, logical_height: 1080
interface: 'wp_presentation', version: 1, name: 5
presentation clock id: 4 (CLOCK_MONOTONIC_RAW)
interface: 'zwp_relative_pointer_manager_v1', version: 1, name: 6
interface: 'zwp_pointer_constraints_v1', version: 1, name: 7
interface: 'zwp_input_timestamps_manager_v1', version: 1, name: 8
interface: 'wl_data_device_manager', version: 3, name: 9
interface: 'wl_shm', version: 1, name: 10
formats (fourcc):
0x36314752 = 'RG16'
1 = 'XR24'
0 = 'AR24'
interface: 'wl_output', version: 3, name: 11
x: 0, y: 0, scale: 1,
physical_width: 0 mm, physical_height: 0 mm,
make: 'weston', model: 'rdp',
subpixel_orientation: unknown, output_transform: normal,
mode:
width: 1920 px, height: 1080 px, refresh: 60.000 Hz,
flags: current preferred
interface: 'zwp_input_panel_v1', version: 1, name: 12
interface: 'zwp_text_input_manager_v1', version: 1, name: 13
interface: 'xdg_wm_base', version: 1, name: 14
interface: 'zxdg_shell_v6', version: 1, name: 15
interface: 'wl_shell', version: 1, name: 16
interface: 'weston_rdprail_shell', version: 1, name: 17
interface: 'weston_screenshooter', version: 1, name: 18
interface: 'wl_seat', version: 7, name: 19
name: RDP CN-00124803
capabilities: pointer keyboard
keyboard repeat rate: 40
keyboard repeat delay: 400
interface: 'zwp_input_method_v1', version: 1, name: 20
interface: 'wl_output', version: 3, name: 21
x: 1920, y: 0, scale: 1,
physical_width: 508 mm, physical_height: 286 mm,
make: 'weston', model: 'rdp',
subpixel_orientation: unknown, output_transform: normal,
mode:
width: 1920 px, height: 1080 px, refresh: 60.000 Hz,
flags: current preferred
+ +

Weston Compositor

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
mkdir -p ~/.config/ && vi ~/.config/weston.ini
[libinput]
enable-tap=true

[shell]
cursor-theme=Adwaita
cursor-size=24

[terminal]
font=monospace
font-size=18

[output]
name=rdp-0
scale=2

[output]
name=rdp-2
scale=3
+ +

GTK with HiDPI

    +
  1. https://docs.gtk.org/gtk3/x11.html
  2. +
  3. https://docs.gtk.org/gtk4/x11.html
  4. +
  5. https://www.qt.io/blog/2016/01/26/high-dpi-support-in-qt-5-6
  6. +
  7. https://wiki.archlinux.org/title/HiDPI
  8. +
+
1
2
3
4
export QT_AUTO_SCREEN_SCALE_FACTOR=1

GDK_SCALE=1.7 GDK_DPI_SCALE=1.7 GTK_THEME=Adwaita emacs
GDK_SCALE=1.7 GDK_DPI_SCALE=1.7 GTK_THEME=Greybird emacs
+ +

fcitx

Installation

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
apt-get install -y --no-install-recommends \
fcitx \
fcitx-config-gtk \
fcitx-frontend-gtk2 \
fcitx-frontend-gtk3 \
fcitx-libpinyin \
fcitx-module-dbus \
fcitx-module-x11 \
fcitx-rime \
fcitx-table-emoji \
fcitx-table-latex \
fcitx-table-wbpy \
fcitx-ui-classic

apt-get install -y --no-install-recommends \
rime-data-emoji \
rime-data-luna-pinyin \
rime-data-terra-pinyin \
rime-data-wubi

export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export XMODIFIERS=@im=fcitx

fcitx-autostart
fcitx-config-gtk3

CTRL + ALT: Trigger input method
SPACE: Toggle English and input method
CTRL + SHIFT: switch input method
+ +

Daily Usage

1
2
3
4
5
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export XMODIFIERS=@im=fcitx

fcitx-autostart
+ +

ibus

Installation

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
apt-get install -y --no-install-recommends \
ibus \
ibus-gtk \
ibus-gtk3 \
ibus-gtk4 \
ibus-input-pad \
ibus-libpinyin \
ibus-rime \
ibus-table-emoji \
ibus-table-latex \
ibus-wayland \
rime-data-emoji \
rime-data-luna-pinyin \
rime-data-terra-pinyin

unset XDG_RUNTIME_DIR
export QT_IM_MODULE=ibus
export GTK_IM_MODULE=ibus
export XMODIFIERS=@im=ibus

dbus-launch ibus-daemon -drx

dbus-launch ibus-setup

pkill ibus-daemon
dbus-launch ibus-daemon -drx
+ +

Daily Usage

1
2
3
4
5
6
7
8
unset XDG_RUNTIME_DIR
export QT_IM_MODULE=ibus
export GTK_IM_MODULE=ibus
export XMODIFIERS=@im=ibus

ibus-daemon -drx

Press Ctrl + space on Windows virtual keyboard can switch ibus input methods.
+ +

Ubuntu 22.04

Create WSL Distribution From RootFs

1
2
curl -LO https://partner-images.canonical.com/oci/jammy/current/ubuntu-jammy-oci-amd64-root.tar.gz
wsl --import Ubuntu-22.04 . ubuntu-jammy-oci-amd64-root.tar.gz
+ +

Sets a Distribution as Default

1
2
3
4
5
6
PS C:\> wsl -s Ubuntu-22.04
PS C:\> wsl --list -v
NAME STATE VERSION
* Ubuntu-22.04 Stopped 2
sles-15 Stopped 2
sles-12 Stopped 2
+ +

Use Environment Variables

1
2
3
4
5
6
7
8
9
10
11
12
DISPLAY=:0
GPG_TTY=/dev/pts/0
HOSTTYPE=x86_64
LS_OPTIONS=-N --color=tty -T 0
PULSE_SERVER=/mnt/wslg/PulseServer
TERM=xterm-256color
WAYLAND_DISPLAY=wayland-0
WSL2_GUI_APPS_ENABLED=1
WSL_DISTRO_NAME=Ubuntu-22.04

alias beep='echo -en "\007"'
alias ip='ip --color=auto'
+ +
1
2
3
4
5
6
7
~> type _ls
_ls is a function
_ls ()
{
local IFS=' ';
command ls $LS_OPTIONS ${1+"$@"}
}
+ +

Update DNS Configuration

1
2
3
4
5
6
7
8
9
10
11
12
13
14
wsl -d Ubuntu-22.04

cat << EOF | tee /etc/wsl.conf
[network]
generateResolvConf = false
EOF

rm -fr /etc/resolv.conf && cat << EOF | tee /etc/resolv.conf
nameserver 193.181.14.10
nameserver 193.181.14.11
nameserver 193.181.14.12
EOF

chattr +iS /etc/resolv.conf
+ +

Configure Locales

1
2
3
4
5
6
7
8
9
10
11
12
13
apt update && apt upgrade -y --no-install-recommends; \
apt install -y --no-install-recommends locales whiptail

# locale -a
C
C.utf8
POSIX

# dpkg-reconfigure locales
Generating locales (this might take a while)...
en_US.UTF-8... done
zh_CN.UTF-8... done
Generation complete.
+ +

Update VIM Configuration

1
2
3
4
5
6
7
8
9
10
11
12
cat << EOF | tee ~/.vimrc
set ignorecase
set nocompatible
set showcmd

syntax on
set nowrap
set autoindent
set nu
set paste
set mouse-=a
EOF
+ +

Create User (uid 1000 issue)

1
2
mount --bind /mnt/wslg/runtime-dir /run/user/$1
umount /run/user/$1
+ +
1
2
3
4
5
6
7
8
9
10
11
12
13
14
apt-get install -y --no-install-recommends sudo vim

groupadd -g 1000 dongsheng || addgroup -g 1000 dongsheng
useradd -g dongsheng -G sudo -u 1000 -s /bin/bash -m dongsheng

# id dongsheng
uid=1000(dongsheng) gid=1000(dongsheng) groups=1000(dongsheng),27(sudo)

vi /etc/sudoers
# User_List Host_List=Runas_Spec? Option_Spec* (Tag_Spec ':')* command_list
%sudo ALL=(ALL:ALL) ALL
->
%sudo ALL=(ALL:ALL) NOPASSWD: ALL
%wheel ALL=(ALL:ALL) NOPASSWD: ALL
+ +

Configure Default User

1
2
3
4
5
6
7
8
9
PS C:\> Get-ItemProperty Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss\*\ DistributionName | Get-ItemProperty | Format-Table -Property DistributionName,Version,State,Flags,DefaultUid,BasePath

DistributionName Version State Flags DefaultUid BasePath
---------------- ------- ----- ----- ---------- --------
Ubuntu-22.04 2 1 15 0 \\?\C:\opt\wsl2\scratch
sles-15 2 1 15 1000 \\?\C:\opt\wsl2\sles-15
sles-12 2 1 15 0 \\?\C:\opt\wsl2\sles-12

Get-ItemProperty Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss\*\ DistributionName | Where-Object -Property DistributionName -eq Ubuntu-22.04 | Set-ItemProperty -Name DefaultUid -Value 1000
+ +

Install The GUI Editor Program

1
sudo apt-get install -y --no-install-recommends adwaita-icon-theme-full at-spi2-core dbus-x11 emacs-gtk gedit
+ +

GTK Configuration

GTK 2

GIMP (2.10.32) is the only useful GUI program that still uses GTK 2.

+
1
2
3
4
5
6
# vi ~/.gtkrc-2.0

gtk-icon-theme-name = Adwaita
# gtk-cursor-theme-size = 16
gtk-font-name = "sans-serif 16"
gtk-theme-name = Greybird
+ +

GTK 3

Most gnome programs now use GTK 3.

+
1
2
3
4
5
6
7
8
9
10
11
# mkdir -p  ~/.config/gtk-3.0/ && vi ~/.config/gtk-3.0/settings.ini

[Settings]
gtk-cursor-theme-name = Adwaita
gtk-cursor-theme-size = 16

gtk-font-name = sans-serif 16

gtk-icon-theme-name = Adwaita
gtk-theme-name = Greybird
gtk-key-theme-name = Emacs
+ +

GTK 4

Only a few gnome programs use GTK 4 today.

+
1
2
3
4
5
6
7
8
9
10
11
# mkdir -p  ~/.config/gtk-4.0/ && vi ~/.config/gtk-4.0/settings.ini

[Settings]
gtk-cursor-theme-name = Adwaita
gtk-cursor-theme-size = 16

gtk-font-name = sans-serif 16

gtk-icon-theme-name = Adwaita
gtk-theme-name = Greybird
gtk-key-theme-name = Emacs
+ +

wayland-info

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
interface: 'wl_compositor', version: 4, name: 1
interface: 'wl_subcompositor', version: 1, name: 2
interface: 'wp_viewporter', version: 1, name: 3
interface: 'zxdg_output_manager_v1', version: 2, name: 4
xdg_output_v1
output: 24
name: 'rdp-5'
logical_x: 1920, logical_y: 0
logical_width: 1280, logical_height: 720
xdg_output_v1
output: 11
name: 'rdp-0'
logical_x: 0, logical_y: 0
logical_width: 1920, logical_height: 1080
interface: 'wp_presentation', version: 1, name: 5
presentation clock id: 4 (CLOCK_MONOTONIC_RAW)
interface: 'zwp_relative_pointer_manager_v1', version: 1, name: 6
interface: 'zwp_pointer_constraints_v1', version: 1, name: 7
interface: 'zwp_input_timestamps_manager_v1', version: 1, name: 8
interface: 'wl_data_device_manager', version: 3, name: 9
interface: 'wl_shm', version: 1, name: 10
formats: RGB565 XRGB8888 ARGB8888
interface: 'wl_output', version: 3, name: 11
x: 0, y: 0, scale: 1,
physical_width: 0 mm, physical_height: 0 mm,
make: 'weston', model: 'rdp',
subpixel_orientation: unknown, output_transform: normal,
mode:
width: 1920 px, height: 1080 px, refresh: 60.000 Hz,
flags: current preferred
interface: 'zwp_input_panel_v1', version: 1, name: 12
interface: 'zwp_text_input_manager_v1', version: 1, name: 13
interface: 'xdg_wm_base', version: 1, name: 14
interface: 'zxdg_shell_v6', version: 1, name: 15
interface: 'wl_shell', version: 1, name: 16
interface: 'weston_rdprail_shell', version: 1, name: 17
interface: 'weston_screenshooter', version: 1, name: 18
interface: 'wl_seat', version: 7, name: 19
name: RDP CN-00124803
capabilities: pointer keyboard
keyboard repeat rate: 40
keyboard repeat delay: 400
interface: 'zwp_input_method_v1', version: 1, name: 20
interface: 'wl_output', version: 3, name: 24
x: 1920, y: 0, scale: 3,
physical_width: 1110 mm, physical_height: 620 mm,
make: 'weston', model: 'rdp',
subpixel_orientation: unknown, output_transform: normal,
mode:
width: 3840 px, height: 2160 px, refresh: 60.000 Hz,
flags: current preferred
+ +

Font Configuration

1
2
3
4
5
6
7
$ fc-list | awk -F : '{ print $1}' | sort -u
/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf
/usr/share/fonts/truetype/dejavu/DejaVuSansMono-Bold.ttf
/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf
/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf
/usr/share/fonts/truetype/dejavu/DejaVuSerif-Bold.ttf
/usr/share/fonts/truetype/dejavu/DejaVuSerif.ttf
+ +

Add Windows Fonts

1
2
vi /etc/fonts/fonts.conf
<dir>/mnt/c/Windows/Fonts/</dir>
+ +
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
fc-cache -rv

fc-match -s 'monospace' | head
fc-match -s 'serif' | head
fc-match -s 'sans-serif' | head

Arial, Tahoma, Calibri, Segoe UI,
Times New Roman, Cambria, Segoe UI Symbol, Segoe UI Emoji
Consolas, Courier New, Segoe UI Symbol, Segoe UI Emoji

Segoe UI Symbol
Segoe UI Emoji
Microsoft YaHei
Microsoft JhengHei

for range in $(fc-match --format='%{charset}\n' "Segoe UI Emoji"); do
for n in $(seq "0x${range%-*}" "0x${range#*-}"); do
printf "%04x\n" "$n";
done;
done | while read -r n_hex; do
count=$((count + 1));
printf "%-5s\U$n_hex\t" "$n_hex";
[ $((count % 10)) = 0 ] && printf "\n";
done

+ +

Disable Embedded Bitmap Fonts

1
2
3
4
5
6
7
8
9
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<match target="font">
<edit name="embeddedbitmap" mode="assign">
<bool>false</bool>
</edit>
</match>
</fontconfig>
+ +

Fix Unrecognized Font Family

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

<!-- by default fontconfig assumes any unrecognized font is sans-serif, so -->
<!-- the fonts above now have /both/ families. fix this. -->
<!-- note that "delete" applies to the first match -->
<match>
<test compare="eq" name="family">
<string>sans-serif</string>
</test>
<test compare="eq" name="family">
<string>monospace</string>
</test>
<edit mode="delete" name="family"/>
</match>


<match target="pattern">
<test qual="all" name="family" compare="not_eq">
<string>sans-serif</string>
</test>
<test qual="all" name="family" compare="not_eq">
<string>serif</string>
</test>
<test qual="all" name="family" compare="not_eq">
<string>monospace</string>
</test>
<edit name="family" mode="append_last">
<string>sans-serif</string>
</edit>
</match>
+ +

Setting Default Fonts

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37

<alias>
<family>sans-serif</family>
<prefer>
<family>Arial</family>
<family>Helvetica</family>
<family>Symbol</family>
<family>Microsoft YaHei UI</family>
<family>SimSun-ExtB</family>
</prefer>
</alias>

<alias>
<family>serif</family>
<prefer>
<family>Times New Roman</family>
<family>Georgia</family>
<family>Symbol</family>
<family>Cambria</family>
<family>Cambria Math</family>
<family>Microsoft YaHei UI</family>
<family>SimSun\-ExtB</family>
</prefer>
</alias>

<alias>
<family>monospace</family>
<prefer>
<family>JetBrains Mono</family>
<family>Consolas</family>
<family>Courier New</family>
<family>Symbol</family>
<family>Cambria Math</family>
<family>Microsoft YaHei UI</family>
<family>SimSun-ExtB</family>
</prefer>
</alias>
+ +

Input Method (IM) Framework - Intelligent Input Bus (IBus)

1
2
3
apt-get install -y --no-install-recommends \
ibus ibus-gtk ibus-gtk3 ibus-gtk4 ibus-input-pad ibus-libpinyin \
ibus-wayland
+ +
1
2
3
4
5
6
7
8
9
10
11
12
13
export NO_AT_BRIDGE=1

export QT_IM_MODULE=ibus
export GTK_IM_MODULE=ibus
export XMODIFIERS=@im=ibus

dbus-launch ibus-daemon -drx

dbus-launch ibus-setup


pkill ibus-daemon
dbus-launch ibus-daemon -drx
+ +
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
libpulse-dev - PulseAudio client development headers and libraries
libpulse-java - PulseAudio sound driver for Java
libao-dev - Cross Platform Audio Output Library Development
libasound2-dev - shared library for ALSA applications -- development files

sudo apt-get install -y --no-install-recommends pulseaudio-utils pulseaudio
pactl list sinks

cat /usr/share/sounds/alsa/*.wav | pacat

sudo apt-get install --no-install-recommends mpg321 cmus moc mp3blaster mpg123


env PULSE_SERVER=server_hostname_or_ip mplayer test.mp3

apt-get install -y --no-install-recommends \
dbus dbus-x11 dbus-user-session python3-dbus \
ibus ibus-gtk ibus-gtk3 ibus-gtk4 ibus-input-pad ibus-libpinyin ibus-rime \
ibus-table-emoji ibus-table-latex ibus-table-wubi ibus-wayland
+ +

Input Method (IM) Framework - Fcitx

1
2
3
4
5
6
7
8
9
10
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 363.1M 1 disk
sdb 8:16 0 4G 0 disk [SWAP]
sdc 8:32 0 256G 0 disk /mnt/wslg/distro
/
sdd 8:48 0 1T 0 disk /mnt/wsl/Coptwsl2scratchext4vhdx

$ cd /mnt/wsl/Coptwsl2scratchext4vhdx
$ sudo chattr -i etc/wsl.conf
+ +
1
2
3
4
5
https://packages.debian.org/bullseye/vainfo
https://devblogs.microsoft.com/commandline/d3d12-gpu-video-acceleration-in-the-windows-subsystem-for-linux-now-available/
sudo apt-get install -y vainfo

vainfo --display drm --device /dev/dri/card0
+ +
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
C:\Windows\System32\wsl.exe
C:\Users\edngsng\AppData\Local\Microsoft\WindowsApps\wsl.exe

wsl.exe -d Alpine-3.17 -u root mount --bind /home/dongsheng /mnt/wsl/Alpine/


/etc/fstab
UUID=e9999b9b-5a8e-41e1-9881-a2f766838798 /home/<username>/vhd-part1 ext4 defaults 0 2

PS C:\> New-VHD -Path $env:USERPROFILE\wsl2-shared.vhdx -Dynamic -SizeBytes 10GB

wsl -d Ubuntu-20.04 --mount --vhd $env:USERPROFILE\wsl2-shared.vhdx --bare
pwsh.exe -Command "wsl.exe -d Ubuntu-20.04 --mount --vhd C:\Users\<username>\wsl2-shared.vhdx --bare | out-null; wsl.exe -d Ubuntu-20.04"

file:///C:/var/vcs/me/user-config/lang/rust/NetBSD-Cross-Build.md
file:///C:/var/vcs/me/user-config/lang/rust/OpenBSD-Cross-Build.md
file:///C:/var/vcs/me/user-config/lang/compiler/gcc/00-summary.md
https://gcc.gnu.org/pub/gcc/snapshots/LATEST-13/

+ 安装 WSL 的内置发行版
+ 从 OCI image 安装发行版
+ DNS 配置
+ SLES 的 repo 配置
+ 在多个发行版中共享数据盘
+ systemd 与后台服务
+ 更新和定制 Linux 内核
+ WSLg,Wayland 和 Weston
+ 用户配置与 uid 1000 问题
+ 常用 GUI 文本编辑器
+ 增加与配置 Windows 或 macOS 的字体
+ 修正 sans-serif,serif 和 monospace 的字体列表
+ GTK 与 HiDPI 的配置
+ 中文输入法的安装与配置
+ IntelliJ IDEA 的配置
+ +
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/dev/sda - Common Base Linux Mariner
https://aka.ms/cbl-mariner
/dev/sdb - swap

First, realize that there are (for the sake of this discussion) two parts to WSL2:

1. The Virtual Machine Platform where the actual WSL2 virtual machine is running. To my knowledge, there's no way for you to actually see or interact with this virtual machine.

2. The WSL2 distributions that you run. These aren't virtual machines themselves, but are instead separate containers created inside individual namespaces.

Each WSL2 distribution (I call them "instances") has its own individual:

+ Users
+ Mounts
+ PID mapping
+ And more

But it also shares some resources with the parent. As with a Docker container:

+ The same kernel is being used for all WSL2 instances
+ The same memory is being used for all WSL2 instances
+ Of course, the same CPU
+ The same device tree (/dev), which includes /dev/sdb where the swap lives.
+ And, most importantly for your question, the same Swap memory itself is being used for all instances.
This swap is handled by and mounted in the parent VM that you can't access. It's reported in /proc/swaps, but that report comes from the parent VM kernel.
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2024/07/13/post-quantum-cryptography-in-openpgp/index.html b/2024/07/13/post-quantum-cryptography-in-openpgp/index.html new file mode 100644 index 00000000..bb4f1519 --- /dev/null +++ b/2024/07/13/post-quantum-cryptography-in-openpgp/index.html @@ -0,0 +1,237 @@ + + + + + + + + + + + + Post-Quantum Cryptography in OpenPGP | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Post-Quantum Cryptography in OpenPGP +

+ +

Post-Quantum Cryptography in OpenPGP

The newly released GnuPG 2.5.0 begins to experimentally support the post-quantum public key algorithm extension of the OpenPGP protocol. The post-quantum public key algorithm extension of the OpenPGP protocol provides the basis for long-term secure OpenPGP signatures and ciphertexts. It defines composite public key encryption based on ML-KEM and composite public key signatures based on ML-DSA (both of which are used in conjunction with elliptic curve cryptography), as well as SLH-DSA as an independent public key signature scheme. GnuPG currently only supports composite public key encryption based on ML-KEM, and support for digital signatures is under development.

+

GnuPG 2.5.0 supports PGC encryption algorithms ky768_cv25519 and ky1024_cv448 based on X25519 and X448, and PQC encryption algorithms ky768_bp256, ky1024_bp384 and ky1024_bp512 based on brainpoolP256r1, brainpoolP384r1 and brainpoolP512r1. Since Brainpool is not efficient, widely used, and has no security advantages, this article only tests PGC encryption algorithms ky768_cv25519 and ky1024_cv448 based on X25519 and X448.

+

What You Need

    +
  • GnuPG 2.5.0 of later
  • +
+

ML-KEM-768 + X25519

Generate Key

1
2
3
4
5
6
7
gpg --quick-gen-key --batch --passphrase='' "X25519 User <x25519@example.com>" Ed25519 cert 1y

gpg --quick-add-key --batch --passphrase='' --pinentry-mode loopback DDE2BD47E5196CED794FDF17D9FFA236037FC097 ed25519 sign,auth 1y
gpg --quick-add-key --batch --passphrase='' --pinentry-mode loopback DDE2BD47E5196CED794FDF17D9FFA236037FC097 cv25519 encrypt 1y

# ML-KEM-768 + X25519
gpg --quick-add-key --batch --passphrase='' --pinentry-mode loopback DDE2BD47E5196CED794FDF17D9FFA236037FC097 ky768_cv25519 encrypt 1y
+ +

List Key

1
2
3
4
5
6
7
8
9
10
$ gpg -K DDE2BD47E5196CED794FDF17D9FFA236037FC097
sec ed25519/D9FFA236037FC097 2024-07-13 [C] [expires: 2024-07-13]
Key fingerprint = DDE2 BD47 E519 6CED 794F DF17 D9FF A236 037F C097
uid [ultimate] X25519 User <x25519@example.com>
ssb ed25519/A2E4D93F5E67CDE2 2024-07-13 [SA] [expires: 2024-07-13]
Key fingerprint = 7660 3CDA E782 AEE7 C42A EF74 A2E4 D93F 5E67 CDE2
ssb cv25519/1D07C17D30191210 2024-07-13 [E] [expires: 2024-07-13]
Key fingerprint = F3AE 317F F319 12E7 E84B 9AC9 1D07 C17D 3019 1210
ssb ky768_cv25519/5C8EC98545A74E6C 2024-07-13 [E] [expires: 2024-07-13]
Key fingerprint = 5C8EC 98545 A74E6 C442A 76F3F 553F9 D39F0 FDF9A 2B7CD 8CA05
+ +

Specify PGC key for encryption

1
2
3
4
5
6
7
8
9
$ echo "Hello, PGC!" > secret.txt
$ gpg --encrypt --yes -r 5C8EC98545A74E6C! secret.txt
$ gpg --decrypt --passphrase='' --pinentry-mode loopback secret.txt.gpg
gpg: encrypted with ky768_cv25519 key, ID 5C8EC98545A74E6C, created 2024-07-13
"X25519 User <x25519@example.com>"
Hello, PGC!
$ stat --printf="%s\t%n\n" secret.txt*
12 secret.txt
1274 secret.txt.gpg
+ +

Specify X25519 key for encryption

1
2
3
4
5
6
7
8
9
$ echo "Hello, PGC!" > secret.txt
$ gpg --encrypt --yes -r 1D07C17D30191210! secret.txt
$ gpg --decrypt --passphrase='' --pinentry-mode loopback secret.txt.gpg
gpg: encrypted with cv25519 key, ID 1D07C17D30191210, created 2024-07-13
"X25519 User <x25519@example.com>"
Hello, PGC!
$ stat --printf="%s\t%n\n" secret.txt*
12 secret.txt
189 secret.txt.gpg
+ +

Automatically select encryption key

1
2
3
4
5
6
7
8
9
$ echo "Hello, PGC!" > secret.txt
$ gpg --encrypt --yes -r D9FFA236037FC097 secret.txt
$ gpg --decrypt --passphrase='' --pinentry-mode loopback secret.txt.gpg
gpg: encrypted with ky768_cv25519 key, ID 5C8EC98545A74E6C, created 2024-07-13
"X25519 User <x25519@example.com>"
Hello, PGC!
$ stat --printf="%s\t%n\n" secret.txt*
12 secret.txt
1274 secret.txt.gpg
+ +

Delete Key

1
gpg --delete-key --batch --yes DDE2BD47E5196CED794FDF17D9FFA236037FC097
+ +

ML-KEM-1024 + X448

Generate Key

1
2
3
4
5
6
7
gpg --quick-gen-key --batch --passphrase='' "X448 User <x448@example.com>" Ed448 cert 1y

gpg --quick-add-key --batch --passphrase='' --pinentry-mode loopback 194E2C38F0C4354C4172DC586E3455C57BA2F61AB06EFC243A5D386ED86242B7 ed448 sign,auth 1y
gpg --quick-add-key --batch --passphrase='' --pinentry-mode loopback 194E2C38F0C4354C4172DC586E3455C57BA2F61AB06EFC243A5D386ED86242B7 cv448 encrypt 1y

# ML-KEM-1024 + X448
gpg --quick-add-key --batch --passphrase='' --pinentry-mode loopback 194E2C38F0C4354C4172DC586E3455C57BA2F61AB06EFC243A5D386ED86242B7 ky1024_cv448 encrypt 1y
+ +

List Key

1
2
3
4
5
6
7
8
9
10
$ gpg -K 194E2C38F0C4354C4172DC586E3455C57BA2F61AB06EFC243A5D386ED86242B7
sec ed448/194E2C38F0C4354C 2024-07-13 [C] [expires: 2024-07-13]
Key fingerprint = 194E2 C38F0 C4354 C4172 DC586 E3455 C57BA 2F61A B06EF C243A
uid [ultimate] X448 User <x448@example.com>
ssb ed448/96EA0B90619ACFCD 2024-07-13 [SA] [expires: 2024-07-13]
Key fingerprint = 96EA0 B9061 9ACFC D5709 BC773 F6300 D1B38 457BC 19792 C4763
ssb cv448/36FC63E177ECC404 2024-07-13 [E] [expires: 2024-07-13]
Key fingerprint = 36FC6 3E177 ECC40 4030B C0004 D91F7 4E1F7 E5590 CEC6A A096F
ssb ky1024_cv448/373E994D9B9AC9AE 2024-07-13 [E] [expires: 2024-07-13]
Key fingerprint = 373E9 94D9B 9AC9A EC476 3FA66 89794 AA808 894BE 4FDF4 020EE
+ +

Specify PGC key for encryption

1
2
3
4
5
6
7
8
9
$ echo "Hello, PGC!" > secret.txt
$ gpg --encrypt --yes -r 373E994D9B9AC9AE! secret.txt
$ gpg --decrypt --passphrase='' --pinentry-mode loopback secret.txt.gpg
gpg: encrypted with ky1024_cv448 key, ID 373E994D9B9AC9AE, created 2024-07-13
"X448 User <x448@example.com>"
Hello, PGC!
$ stat --printf="%s\t%n\n" secret.txt*
12 secret.txt
1778 secret.txt.gpg
+ +

Specify X448 key for encryption

1
2
3
4
5
6
7
8
9
$ echo "Hello, PGC!" > secret.txt
$ gpg --encrypt --yes -r 36FC63E177ECC404! secret.txt
$ gpg --decrypt --passphrase='' --pinentry-mode loopback secret.txt.gpg
gpg: encrypted with cv448 key, ID 36FC63E177ECC404, created 2024-07-13
"X448 User <x448@example.com>"
Hello, PGC!
$ stat --printf="%s\t%n\n" secret.txt*
12 secret.txt
212 secret.txt.gpg
+ +

Automatically select encryption key

1
2
3
4
5
6
7
8
9
$ echo "Hello, PGC!" > secret.txt
$ gpg --encrypt --yes -r 194E2C38F0C4354C secret.txt
$ gpg --decrypt --passphrase='' --pinentry-mode loopback secret.txt.gpg
gpg: encrypted with ky1024_cv448 key, ID 373E994D9B9AC9AE, created 2024-07-13
"X448 User <x448@example.com>"
Hello, PGC!
$ stat --printf="%s\t%n\n" secret.txt*
12 secret.txt
1778 secret.txt.gpg
+ +

Delete Key

1
gpg --delete-key --batch --yes 194E2C38F0C4354C4172DC586E3455C57BA2F61AB06EFC243A5D386ED86242B7
+ +

ML-DSA-65 + Ed25519

1
2
# Not working yet
gpg --quick-add-key --batch --passphrase='' --pinentry-mode loopback DDE2BD47E5196CED794FDF17D9FFA236037FC097 dil3_ed25519 sign 1y
+ +

ML-DSA-87 + Ed448

1
2
# Not working yet
gpg --quick-add-key --batch --passphrase='' --pinentry-mode loopback 194E2C38F0C4354C4172DC586E3455C57BA2F61AB06EFC243A5D386ED86242B7 dil5_ed448 sign 1y
+ +

Wrapping Up

OpenPGP currently does not fully support the PGC algorithm. It only supports encryption algorithms and lacks digital signature algorithms. It only supports generating PGC keys in the quick-gen-key and quick-add-key interfaces, but does not support generating PGC keys in the interactive interface.

+

The current state of OpenPGP’s PGC implementation is quite exciting, considering that the algorithm is still in the draft stage. Let’s look forward to the PGC algorithm being fully supported in OpenPGP, making our future more secure.

+

Reference

+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2024/07/14/openssh-login-with-gnupg-openpgp-keys/index.html b/2024/07/14/openssh-login-with-gnupg-openpgp-keys/index.html new file mode 100644 index 00000000..06d89290 --- /dev/null +++ b/2024/07/14/openssh-login-with-gnupg-openpgp-keys/index.html @@ -0,0 +1,262 @@ + + + + + + + + + + + + OpenSSH Login with GnuPG (OpenPGP) Keys | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ OpenSSH Login with GnuPG (OpenPGP) Keys +

+ +

OpenSSH Login with GnuPG Keys

Many people don’t know that they can use OpenPGP (GnuPG) keys to log in to the OpenSSH server. Instead, they generate two sets of keys and use them independently. Using OpenPGP keys to log in to the OpenSSH server can make our lives more convenient and more secure. Let’s start our journey.

+

What You Need

    +
  • GnuPG 2.1.9 or later
  • +
+

Password Generator

Using secure passwords is one of the best security practices. It is recommended to use apg or pwgen as a password generator:

+
1
2
3
$ dpkg -l | grep -E 'apg|pwgen'
ii apg 2.2.3.dfsg.1-5 amd64 Automated Password Generator - Standalone version
ii pwgen 2.08-2 amd64 Automatic Password generation
+ +

Usage:

+
1
2
3
4
5
6
7
8
9
$ apg -a 1 -M SNCL -m 8 -x 8 -n 8
(8tY~>Cp
p4d$MYNH
'-xTtA5:
X3hS6vH&
~0r5uXwJ
v~r"6oQG
FF&*0f8(
;ykb0LZQ
+ +
1
2
3
4
5
6
7
8
9
$ pwgen -1 -s -B -y -n -c 8 8
X3h^Y/ve
e\E=w<7v
;b7AwVub
@\mC!3q;
4oA'`-Hv
#=otwp9F
N4:#P[=:
@Ftm=~3`
+ +

Generate Key

Note that variable PP is the sample password, and KF is the generated master key fingerprint. Please replace them with your own corresponding password and master key fingerprint respectively.

+
1
2
PP='Vx@e0l6y'
gpg --quick-gen-key --batch --passphrase="${PP}" "X25519 User <x25519@example.com>" Ed25519 cert 1y
+ +
1
2
3
4
KF='EE84D73B6CEC596BDEB56EEF2F9DE5D06993DEF0'
gpg --quick-add-key --batch --passphrase="${PP}" --pinentry-mode loopback ${KF} ed25519 sign 1y
gpg --quick-add-key --batch --passphrase="${PP}" --pinentry-mode loopback ${KF} cv25519 encrypt 1y
gpg --quick-add-key --batch --passphrase="${PP}" --pinentry-mode loopback ${KF} ed25519 auth 1y
+ +

List Key

Let’s view the OpenPGP Keys we just generated:

+
1
2
3
4
5
6
7
$ gpg -K ${KF} --with-keygrip
sec ed25519/2F9DE5D06993DEF0 2024-07-13 [C] [expires: 2025-07-13]
Key fingerprint = EE84 D73B 6CEC 596B DEB5 6EEF 2F9D E5D0 6993 DEF0
uid [ultimate] X25519 User <x25519@example.com>
ssb ed25519/A9E9E2021A84B4FB 2024-07-13 [S] [expires: 2025-07-13]
ssb cv25519/140347FF8E0A799F 2024-07-13 [E] [expires: 2025-07-13]
ssb ed25519/DCA34AA211A525C3 2024-07-13 [A] [expires: 2025-07-13]
+ +

Note that the purpose of the subkey DCA34AA211A525C3 contains the letter A (auth), indicating that it can be used for authentication, such as logging into an OpenSSH server.

+

Export SSH Key

Let’s export the public key that the OpenSSH server needs:

+
1
2
$ gpg --export-ssh-key "${KF}"
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMpjycTr1bb3jNBU/AdtsKjDX1Kz79pZsvz4kHnGM5wg openpgp:0x11A525C3
+ +

Note that the comment part 11A525C3 of this public key is the last 8 hexadecimal characters of the subkey DCA34AA211A525C3.

+

Update ~/.ssh/authorized_keys in OpenSSH Server

The method of uploading the public key to the OpenSSH server depends on the configuration and deployment of the server. For common OpenSSH servers, it is usually directly added to the file ~/.ssh/authorized_keys in the user directory:

+
1
echo 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMpjycTr1bb3jNBU/AdtsKjDX1Kz79pZsvz4kHnGM5wg openpgp:0x11A525C3' >> ~/.ssh/authorized_keys
+ +

Update ~/.gnupg/sshcontrol

In order to let the local gpg-agent know that this OpenPGP subkey can be used for OpenSSH authentication, we need to add its keygrip to the file ~/.gnupg/sshcontrol.

+

Execute the following command to find the keygrip of this subkey:

+
1
2
3
4
5
6
7
8
9
10
11
gpg -K --with-keygrip ${KF}
sec ed25519/2F9DE5D06993DEF0 2024-07-13 [C] [expires: 2025-07-13]
Key fingerprint = EE84 D73B 6CEC 596B DEB5 6EEF 2F9D E5D0 6993 DEF0
Keygrip = DFF57AE620812596C463FDC4110E15A56ED5ACE2
uid [ultimate] X25519 User <x25519@example.com>
ssb ed25519/A9E9E2021A84B4FB 2024-07-13 [S] [expires: 2025-07-13]
Keygrip = 1682922D586DDDFC461E73A7E5C91E7EF0BBA748
ssb cv25519/140347FF8E0A799F 2024-07-13 [E] [expires: 2025-07-13]
Keygrip = 038AA856070E9097CACB1939427393D1E0125E40
ssb ed25519/DCA34AA211A525C3 2024-07-13 [A] [expires: 2025-07-13]
Keygrip = 8C1FC82074A83ED40D851259694BBFB92B94A344
+ +

We can see that the Keygrip of subkey DCA34AA211A525C3 is 8C1FC82074A83ED40D851259694BBFB92B94A344, let’s add it to the file ~/.gnupg/sshcontrol:

+
1
$ echo '8C1FC82074A83ED40D851259694BBFB92B94A344' >> ~/.gnupg/sshcontrol
+ +

Update ~/.gnupg/gpg-agent.conf

This step is optional and updates the file ~/.gnupg/gpg-agent.conf to change the TTL of the key and to display the fingerprint of the SSH key using SHA256 instead of MD5:

+
1
2
3
4
5
6
default-cache-ttl 1800
default-cache-ttl-ssh 1800
disable-scdaemon
enable-putty-support
enable-ssh-support
ssh-fingerprint-digest SHA256
+ +

Update ~/.ssh/config

This step is also optional, because when gpg-agent is not started, OpenSSH cannot use public key authentication, so we use a feature of the OpenSSH client configuration to automatically execute the command gpg-connect-agent, which in turn uses a feature that automatically starts gpg-agent when it finds that it is not started:

+
1
2
3
4
5
6
$ vi ~/.ssh/config
# Linux
Match host * exec "gpg-connect-agent UPDATESTARTUPTTY /bye"

# Windows
Match host * exec "gpg-connect-agent UPDATESTARTUPTTY /bye >NUL 2>&1"
+ +

Note that although this step is optional, it executes UPDATESTARTUPTTY, which ensures that gpg-agent pops up the password input box in the current window and does not find the wrong window. This is particularly useful on Linux systems, especially when using terminal multiplexers such as tmux.

+

Update ~/.bashrc

For example, in the file ~/.bashrc, ~/.bash_profile or ~/.profile, in the interactive login section, configure the environment variable GPG_TTY:

+
1
2
3
export GPG_TTY=`tty`
# gpg-connect-agent UPDATESTARTUPTTY /bye
# ssh-add -l
+ +

If you do not want to log in again, you can execute the following command to make it take effect:

+
1
$ source ~/.bashrc
+ +

or:

+
1
$ export GPG_TTY=`tty`
+ +

Try OpenSSH Login

Now that everything is done, let’s try logging into OpenSSH using our GnuPG key:

+
1
2
3
4
5
6
7
8
9
10
11
$ ssh <user>@example.com

┌──────────────────────────────────────────────────────┐
│ Please enter the passphrase for the ssh key │
│ SHA256:ZbVC8wNc1vdBSNDh7+xfupzc0bDUEElJZ3EyGxuzUVU │
│ │
│ │
│ Passphrase: ________________________________________ │
│ │
│ <OK> <Cancel> │
└──────────────────────────────────────────────────────┘
+ +

Enter the password we provided when generating the OpenPGP key, and we are logged in to the remote OpenSSH server.

+

Mapping of OpenPGP Keys and SSH Fingerprints

Sometimes we have many keys available for SSH login, and we may not be able to find the OpenPGP key corresponding to the SSH fingerprint. In this case, the following script is very useful:

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash

gpg_keys=$(gpg -K --list-options show-usage | grep -E '(^sec|^ssb)' | awk '$4 ~ /A/ {print $2}')

for key in $gpg_keys; do
fingerprint=$(echo $key | cut -d'/' -f2)

gpg_ssh_fingerprint=$(gpg --export-ssh-key $fingerprint! | ssh-keygen -lf - | awk '{print $2}')
ssh_keys=$(ssh-add -l | awk '{print $2}')

for ssh_key in $ssh_keys; do
if [ "$gpg_ssh_fingerprint" == "$ssh_key" ]; then
echo "OpenPGP $key -> SSH $ssh_key"
fi
done
done


OpenPGP rsa2048/0401AA2046D397FF -> SSH SHA256:Oa8egR/Az0cyo44IjvkrzHKownGgo59LctsMmEBNXyo
OpenPGP ed25519/CB7D373D4F999240 -> SSH SHA256:ZbVC8wNc1vdBSNDh7+xfupzc0bDUEElJZ3EyGxuzUVU
...
+ +

Delete Key

Now that the test is complete, let’s delete the OpenPGP test key we just generated:

+
1
$ gpg --delete-key --batch --yes ${KF}
+ +

In addition, don’t forget to delete the records we added in the file ~/.gnupg/sshcontrol and the file ~/.ssh/authorized_keys. The changes to other files can be retained. Of course, if you want to delete GnuPG as well, you also need to delete the records we added in the file ~/.ssh/config.

+

Wrapping Up

The pursuit of security, reliability and simplicity has always been one of our goals. Let’s start by using OpenPGP keys and GnuPG to log in to the OpenSSH server!

+

Reference

+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/2024/07/28/rust-project-promote-the-wasm32-wasip2-target-to-tier-2/index.html b/2024/07/28/rust-project-promote-the-wasm32-wasip2-target-to-tier-2/index.html new file mode 100644 index 00000000..ef457e21 --- /dev/null +++ b/2024/07/28/rust-project-promote-the-wasm32-wasip2-target-to-tier-2/index.html @@ -0,0 +1,302 @@ + + + + + + + + + + + + Rust project promote the wasm32-wasip2 target to Tier 2 | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ Rust project promote the wasm32-wasip2 target to Tier 2 +

+ +

Rust project promote the wasm32-wasip2 target to Tier 2

The wasm32-wasip2 target is an extension to wasm32-wasip1 target, originally known as wasm32-wasi. It is the next evolution in the development of WASI (the WebAssembly System Interface) that uses the WebAssembly component model to allow for a standardized set of syscalls that are intended to empower WebAssembly binaries with native host capabilities. This target is cross-compiled. The target supports std fully.

+

On February 28, 2024, Rust merged the tier 3 target wasm32-wasip2; on July 17, 2024, the target wasm32-wasip2 was promoted to tier 2.

+

WASI has released two milestone versions, 0.1 and 0.2. They correspond to Rust targets wasm32-wasip1 and wasm32-wasip2 respectively.

+

WASI Preview 2 represents a major milestone for WASI. It marks the moment when WASI has fully rebased on the Wit IDL and the component model type system and semantics, making it modular, fully virtualizable, and accessible to a wide variety of source languages.

+

WASI Preview 2 is also known as “WASI 0.2”, and corresponds to versions numbered 0.2.x in Wit packages and related identifiers. It is also known as “WASIp2”, where the “p” stands for either “preview” or “point”.

+

WASI Preview 2 contains the following APIs:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ProposalVersions
wasi-io0.2.0
wasi-clocks0.2.0
wasi-random0.2.0
wasi-filesystem0.2.0
wasi-sockets0.2.0
wasi-cli0.2.0
wasi-http0.2.0
+

What You Need

    +
  • WASI SDK 23.0 or later
  • +
  • wasmtime 23.0.1 or later
  • +
  • WasmEdge 0.14.0 or later (wasm32-wasip1 only)
  • +
  • wasmer 4.3.5 or later (wasm32-wasip1 only)
  • +
  • wasmi 0.36.0 or later (No binary packages, requires rust 1.77.0 or newer to compile) (wasm32-wasip1 only)
  • +
  • wazero 1.7.3 or later (wasm32-wasip1 only)
  • +
  • WebAssembly Micro Runtime 2.1.1 or later (wasm32-wasip1 only)
  • +
+

WASI SDK

Let’s first use the classic Hello World program to test the each WASI implementation:

+

hello.c

1
2
3
4
5
6
#include <stdio.h>
int main(void)
{
fprintf(stdout, "Hello, World!\n");
return 0;
}
+ +

wasm32-wasip1

Generate WASM files for target wasm32-wasip1:

+
1
2
3
4
5
6
# /opt/wasi-sdk-23/bin/clang -v -Wl,--version --target=wasm32-wasip1

# /opt/wasi-sdk-23/bin/clang --target=wasm32-wasip1 -o hello-p1.wasm hello.c

# file hello-p1.wasm
hello-p1.wasm: WebAssembly (wasm) binary module version 0x1 (MVP)
+ +

All 6 WASI implementations used in this article support the target wasm32-wasip1:

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# wasmtime hello-p1.wasm
Hello, World!

# wasmedge hello-p1.wasm
Hello, World!

# wasmer hello-p1.wasm
Hello, World!

# wasmi_cli hello-p1.wasm
Hello, World!

# wazero run hello-p1.wasm
Hello, World!

# iwasm hello-p1.wasm
Hello, World!
+ +

wasm32-wasip2

Generate WASM files for target wasm32-wasip2:

+
1
2
3
4
5
6
# /opt/wasi-sdk-23/bin/clang -v -Wl,--version --target=wasm32-wasip2

# /opt/wasi-sdk-23/bin/clang --target=wasm32-wasip2 -o hello-p2.wasm hello.c

# file hello-p2.wasm
hello-p2.wasm: WebAssembly (wasm) binary module version 0x1000d
+ +

wasmtime

Earlier versions of wasmtime would report an error:

+
1
2
# wasmtime hello-p2.wasm
Error: cannot execute a component without `--wasm component-model`
+ +

The new version of wasmtime has no problem:

+
1
2
# wasmtime hello-p1.wasm
Hello, World!
+ +

wasmedge

wasmedge runs with an error, requiring component model support to be enabled:

+
1
2
3
4
5
6
# wasmedge hello-p2.wasm
[error] loading failed: illegal opcode, Code: 0x117
[error] This instruction or syntax requires enabling Component Model proposal
[error] Bytecode offset: 0x00000004
[error] At AST node: component
[error] File name: "hello-p2.wasm"
+ +

In fact, it is still unsuccessful to enable support for the component model:

+
1
2
3
4
5
6
7
8
9
root@wsl2-leap:~# wasmedge --enable-component hello-p2.wasm
[warning] component model is enabled, this is experimental.
[warning] component model is an experimental proposal
[error] Might an invalid wasm file
[error] loading failed: magic header not detected, Code: 0x103
[error] Bytecode offset: 0x000410a9
[error] At AST node: component
[error] At AST node: component
[error] File name: "hello-p2.wasm"
+ +

wasmer

wasmer does not support WASI 0.2 yet:

+
1
2
3
# wasmer run hello-p2.wasm
error: Unable to compile "hello-p2.wasm"
╰─▶ 1: compile error
+ +

wasmi

wasmi does not support WASI 0.2 yet:

+
1
2
# wasmi_cli hello-p2.wasm
Error: failed to parse and validate Wasm module "hello-p2.wasm": unknown binary version: 0xd, note: the WebAssembly component model feature is not enabled (at offset 0x0)
+ +

wazero

wazero does not support WASI 0.2 yet:

+
1
2
# wazero run hello-p2.wasm
error compiling wasm binary: invalid version header
+ +

WebAssembly Micro Runtime

WebAssembly Micro Runtime does not support WASI 0.2 yet:

+
1
2
# iwasm hello-p2.wasm
WASM module load failed: unknown binary version
+ +

Rust

Let’s test each WASI implementation with a Rust implementation of the classic Hello World program:

+

hello.rs

1
2
3
fn main() {
println!("Hello, World!");
}
+ +

wasm32-wasip1

Generate WASM files for target wasm32-wasip1:

+
1
2
3
4
# rustc -v --target wasm32-wasip1 -o hello-p1.wasm hello.rs

# file hello-p1.wasm
hello-p1.wasm: WebAssembly (wasm) binary module version 0x1 (MVP)
+ +

All 6 WASI implementations used in this article support the target wasm32-wasip1:

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# wasmtime hello-p1.wasm
Hello, World!

# wasmedge hello-p1.wasm
Hello, World!

# wasmer hello-p1.wasm
Hello, World!

# wasmi_cli hello-p1.wasm
Hello, World!

# wazero run hello-p1.wasm
Hello, World!

# iwasm hello-p1.wasm
Hello, World!
+ +

wasm32-wasip2

Generate WASM files for target wasm32-wasip2:

+
1
2
3
4
# rustc -v --target wasm32-wasip1 -o hello-p1.wasm hello.rs

# file hello-p1.wasm
hello-p1.wasm: WebAssembly (wasm) binary module version 0x1 (MVP)
+ +

Wrapping Up

The component model is expected to add future and stream keywords, which will provide integrated and composable async functionality. WASI Preview 3 is planned to be a major revision of the Preview 2 APIs using these new features in place of wasi-io‘s streams and polling interfaces. It’s also expected to incorporate lessons learned from implementation and user experience with Preview 2.

+

When Preview 3 is launched, implementations may continue to support Preview 2, either by implementing Preview 3 along side it, or by virtualizing (polyfilling) Preview 2 in terms of Preview 3.

+

The release criteria of Preview 3 will include that performance will be measured and addressed.

+

Reference

+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/about/index.html b/about/index.html new file mode 100644 index 00000000..46699b2b --- /dev/null +++ b/about/index.html @@ -0,0 +1,158 @@ + + + + + + + + + + + + 关于 | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ 关于 +

+ + +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + diff --git a/archives/2018/11/index.html b/archives/2018/11/index.html new file mode 100644 index 00000000..ead0f445 --- /dev/null +++ b/archives/2018/11/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + Archives | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ + + + + + + diff --git a/archives/2018/12/index.html b/archives/2018/12/index.html new file mode 100644 index 00000000..ead0f445 --- /dev/null +++ b/archives/2018/12/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + Archives | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ + + + + + + diff --git a/archives/2018/index.html b/archives/2018/index.html new file mode 100644 index 00000000..ead0f445 --- /dev/null +++ b/archives/2018/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + Archives | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ + + + + + + diff --git a/archives/2019/01/index.html b/archives/2019/01/index.html new file mode 100644 index 00000000..ead0f445 --- /dev/null +++ b/archives/2019/01/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + Archives | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ + + + + + + diff --git a/archives/2019/02/index.html b/archives/2019/02/index.html new file mode 100644 index 00000000..ead0f445 --- /dev/null +++ b/archives/2019/02/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + Archives | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ + + + + + + diff --git a/archives/2019/03/index.html b/archives/2019/03/index.html new file mode 100644 index 00000000..ead0f445 --- /dev/null +++ b/archives/2019/03/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + Archives | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ + + + + + + diff --git a/archives/2019/04/index.html b/archives/2019/04/index.html new file mode 100644 index 00000000..ead0f445 --- /dev/null +++ b/archives/2019/04/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + Archives | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ + + + + + + diff --git a/archives/2019/05/index.html b/archives/2019/05/index.html new file mode 100644 index 00000000..ead0f445 --- /dev/null +++ b/archives/2019/05/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + Archives | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ + + + + + + diff --git a/archives/2019/06/index.html b/archives/2019/06/index.html new file mode 100644 index 00000000..ead0f445 --- /dev/null +++ b/archives/2019/06/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + Archives | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ + + + + + + diff --git a/archives/2019/07/index.html b/archives/2019/07/index.html new file mode 100644 index 00000000..ead0f445 --- /dev/null +++ b/archives/2019/07/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + Archives | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ + + + + + + diff --git a/archives/2019/08/index.html b/archives/2019/08/index.html new file mode 100644 index 00000000..ead0f445 --- /dev/null +++ b/archives/2019/08/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + Archives | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ + + + + + + diff --git a/archives/2019/09/index.html b/archives/2019/09/index.html new file mode 100644 index 00000000..ead0f445 --- /dev/null +++ b/archives/2019/09/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + Archives | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ + + + + + + diff --git a/archives/2019/10/index.html b/archives/2019/10/index.html new file mode 100644 index 00000000..ead0f445 --- /dev/null +++ b/archives/2019/10/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + Archives | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ + + + + + + diff --git a/archives/2019/11/index.html b/archives/2019/11/index.html new file mode 100644 index 00000000..ead0f445 --- /dev/null +++ b/archives/2019/11/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + Archives | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ + + + + + + diff --git a/archives/2019/12/index.html b/archives/2019/12/index.html new file mode 100644 index 00000000..ead0f445 --- /dev/null +++ b/archives/2019/12/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + Archives | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ + + + + + + diff --git a/archives/2019/index.html b/archives/2019/index.html new file mode 100644 index 00000000..ead0f445 --- /dev/null +++ b/archives/2019/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + Archives | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ + + + + + + diff --git a/archives/2020/01/index.html b/archives/2020/01/index.html new file mode 100644 index 00000000..ead0f445 --- /dev/null +++ b/archives/2020/01/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + Archives | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ + + + + + + diff --git a/archives/2020/02/index.html b/archives/2020/02/index.html new file mode 100644 index 00000000..ead0f445 --- /dev/null +++ b/archives/2020/02/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + Archives | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ + + + + + + diff --git a/archives/2020/03/index.html b/archives/2020/03/index.html new file mode 100644 index 00000000..ead0f445 --- /dev/null +++ b/archives/2020/03/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + Archives | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ + + + + + + diff --git a/archives/2020/04/index.html b/archives/2020/04/index.html new file mode 100644 index 00000000..ead0f445 --- /dev/null +++ b/archives/2020/04/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + Archives | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ + + + + + + diff --git a/archives/2020/05/index.html b/archives/2020/05/index.html new file mode 100644 index 00000000..ead0f445 --- /dev/null +++ b/archives/2020/05/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + Archives | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ + + + + + + diff --git a/archives/2020/09/index.html b/archives/2020/09/index.html new file mode 100644 index 00000000..ead0f445 --- /dev/null +++ b/archives/2020/09/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + Archives | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ + + + + + + diff --git a/archives/2020/11/index.html b/archives/2020/11/index.html new file mode 100644 index 00000000..ead0f445 --- /dev/null +++ b/archives/2020/11/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + Archives | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ + + + + + + diff --git a/archives/2020/12/index.html b/archives/2020/12/index.html new file mode 100644 index 00000000..ead0f445 --- /dev/null +++ b/archives/2020/12/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + Archives | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ + + + + + + diff --git a/archives/2020/index.html b/archives/2020/index.html new file mode 100644 index 00000000..ead0f445 --- /dev/null +++ b/archives/2020/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + Archives | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ + + + + + + diff --git a/archives/2021/01/index.html b/archives/2021/01/index.html new file mode 100644 index 00000000..ead0f445 --- /dev/null +++ b/archives/2021/01/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + Archives | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ + + + + + + diff --git a/archives/2021/03/index.html b/archives/2021/03/index.html new file mode 100644 index 00000000..ead0f445 --- /dev/null +++ b/archives/2021/03/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + Archives | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ + + + + + + diff --git a/archives/2021/04/index.html b/archives/2021/04/index.html new file mode 100644 index 00000000..ead0f445 --- /dev/null +++ b/archives/2021/04/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + Archives | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ + + + + + + diff --git a/archives/2021/08/index.html b/archives/2021/08/index.html new file mode 100644 index 00000000..ead0f445 --- /dev/null +++ b/archives/2021/08/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + Archives | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ + + + + + + diff --git a/archives/2021/09/index.html b/archives/2021/09/index.html new file mode 100644 index 00000000..ead0f445 --- /dev/null +++ b/archives/2021/09/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + Archives | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ + + + + + + diff --git a/archives/2021/10/index.html b/archives/2021/10/index.html new file mode 100644 index 00000000..ead0f445 --- /dev/null +++ b/archives/2021/10/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + Archives | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ + + + + + + diff --git a/archives/2021/index.html b/archives/2021/index.html new file mode 100644 index 00000000..ead0f445 --- /dev/null +++ b/archives/2021/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + Archives | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ + + + + + + diff --git a/archives/2022/01/index.html b/archives/2022/01/index.html new file mode 100644 index 00000000..ead0f445 --- /dev/null +++ b/archives/2022/01/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + Archives | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ + + + + + + diff --git a/archives/2022/11/index.html b/archives/2022/11/index.html new file mode 100644 index 00000000..ead0f445 --- /dev/null +++ b/archives/2022/11/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + Archives | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ + + + + + + diff --git a/archives/2022/index.html b/archives/2022/index.html new file mode 100644 index 00000000..ead0f445 --- /dev/null +++ b/archives/2022/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + Archives | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ + + + + + + diff --git a/archives/2023/02/index.html b/archives/2023/02/index.html new file mode 100644 index 00000000..ead0f445 --- /dev/null +++ b/archives/2023/02/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + Archives | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ + + + + + + diff --git a/archives/2023/index.html b/archives/2023/index.html new file mode 100644 index 00000000..ead0f445 --- /dev/null +++ b/archives/2023/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + Archives | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ + + + + + + diff --git a/archives/2024/07/index.html b/archives/2024/07/index.html new file mode 100644 index 00000000..ead0f445 --- /dev/null +++ b/archives/2024/07/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + Archives | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ + + + + + + diff --git a/archives/2024/index.html b/archives/2024/index.html new file mode 100644 index 00000000..ead0f445 --- /dev/null +++ b/archives/2024/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + Archives | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ + + + + + + diff --git a/archives/index.html b/archives/index.html new file mode 100644 index 00000000..bdc21b15 --- /dev/null +++ b/archives/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + Archives | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ + + + + + + diff --git a/archives/page/2/index.html b/archives/page/2/index.html new file mode 100644 index 00000000..ead0f445 --- /dev/null +++ b/archives/page/2/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + Archives | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ + + + + + + diff --git a/categories/Architecture/Principle/index.html b/categories/Architecture/Principle/index.html new file mode 100644 index 00000000..89f8fab0 --- /dev/null +++ b/categories/Architecture/Principle/index.html @@ -0,0 +1,117 @@ + + + + + + + + + + + + Principle | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + +
+

2021

+ +
+ +
+
+ + + + + + + diff --git a/categories/Architecture/RBAC/index.html b/categories/Architecture/RBAC/index.html new file mode 100644 index 00000000..8c56e12e --- /dev/null +++ b/categories/Architecture/RBAC/index.html @@ -0,0 +1,99 @@ + + + + + + + + + + + + RBAC | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + +
+

2019

+ +
+ +
+
+ + + + + + + diff --git a/categories/Architecture/TCC/index.html b/categories/Architecture/TCC/index.html new file mode 100644 index 00000000..3f1d5124 --- /dev/null +++ b/categories/Architecture/TCC/index.html @@ -0,0 +1,99 @@ + + + + + + + + + + + + TCC | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + +
+

2019

+ +
+ +
+
+ + + + + + + diff --git a/categories/Architecture/UML/index.html b/categories/Architecture/UML/index.html new file mode 100644 index 00000000..0cb52850 --- /dev/null +++ b/categories/Architecture/UML/index.html @@ -0,0 +1,99 @@ + + + + + + + + + + + + UML | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + +
+

2019

+ +
+ +
+
+ + + + + + + diff --git a/categories/Architecture/index.html b/categories/Architecture/index.html new file mode 100644 index 00000000..1002205b --- /dev/null +++ b/categories/Architecture/index.html @@ -0,0 +1,194 @@ + + + + + + + + + + + + Architecture | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + +
+

2021

+ +
+ +
+

2019

+ +
+ +
+

2018

+ +
+ +
+
+ + + + + + + diff --git a/categories/Cloud/Container/index.html b/categories/Cloud/Container/index.html new file mode 100644 index 00000000..d31cb522 --- /dev/null +++ b/categories/Cloud/Container/index.html @@ -0,0 +1,140 @@ + + + + + + + + + + + + Container | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + + + +
+

2019

+ +
+ +
+

2018

+ +
+ +
+
+ + + + + + + diff --git a/categories/Cloud/Hadoop/index.html b/categories/Cloud/Hadoop/index.html new file mode 100644 index 00000000..a1aab881 --- /dev/null +++ b/categories/Cloud/Hadoop/index.html @@ -0,0 +1,108 @@ + + + + + + + + + + + + Hadoop | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + +
+

2018

+ +
+ +
+
+ + + + + + + diff --git a/categories/Cloud/Kubernetes/index.html b/categories/Cloud/Kubernetes/index.html new file mode 100644 index 00000000..892d922d --- /dev/null +++ b/categories/Cloud/Kubernetes/index.html @@ -0,0 +1,158 @@ + + + + + + + + + + + + Kubernetes | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + +
+

2021

+ +
+ +
+

2020

+ +
+ + + +
+
+ + + + + + + diff --git a/categories/Cloud/index.html b/categories/Cloud/index.html new file mode 100644 index 00000000..44869be4 --- /dev/null +++ b/categories/Cloud/index.html @@ -0,0 +1,228 @@ + + + + + + + + + + + + Cloud | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + +
+

2021

+ +
+ + + + + + + +
+
+ + + + + + + diff --git a/categories/Operating-system/FreeBSD/index.html b/categories/Operating-system/FreeBSD/index.html new file mode 100644 index 00000000..c34e150d --- /dev/null +++ b/categories/Operating-system/FreeBSD/index.html @@ -0,0 +1,149 @@ + + + + + + + + + + + + FreeBSD | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + +
+

2022

+ +
+ +
+

2021

+ +
+ + + +
+
+ + + + + + + diff --git a/categories/Operating-system/Linux/index.html b/categories/Operating-system/Linux/index.html new file mode 100644 index 00000000..1e142bbe --- /dev/null +++ b/categories/Operating-system/Linux/index.html @@ -0,0 +1,399 @@ + + + + + + + + + + + + Linux | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + +
+

2022

+ +
+ +
+

2021

+ +
+ + + +
+

2019

+ +
+ +
+
+ + + + + + + diff --git a/categories/Operating-system/NetBSD/index.html b/categories/Operating-system/NetBSD/index.html new file mode 100644 index 00000000..5d23db4a --- /dev/null +++ b/categories/Operating-system/NetBSD/index.html @@ -0,0 +1,142 @@ + + + + + + + + + + + + NetBSD | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + +
+

2021

+ +
+ + + +
+
+ + + + + + + diff --git a/categories/Operating-system/OpenBSD/index.html b/categories/Operating-system/OpenBSD/index.html new file mode 100644 index 00000000..e26287fc --- /dev/null +++ b/categories/Operating-system/OpenBSD/index.html @@ -0,0 +1,99 @@ + + + + + + + + + + + + OpenBSD | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + +
+

2020

+ +
+ +
+
+ + + + + + + diff --git a/categories/Operating-system/Windows/index.html b/categories/Operating-system/Windows/index.html new file mode 100644 index 00000000..1771f74c --- /dev/null +++ b/categories/Operating-system/Windows/index.html @@ -0,0 +1,183 @@ + + + + + + + + + + + + Windows | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + + + +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ + + + + + + diff --git a/categories/Operating-system/index.html b/categories/Operating-system/index.html new file mode 100644 index 00000000..62cc0431 --- /dev/null +++ b/categories/Operating-system/index.html @@ -0,0 +1,656 @@ + + + + + + + + + + + + Operating system | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + + + +
+

2022

+ +
+ + + +
+

2020

+ +
+ + + + + +
+
+ + + + + + + diff --git a/categories/Processor/Arm/index.html b/categories/Processor/Arm/index.html new file mode 100644 index 00000000..5fec0a05 --- /dev/null +++ b/categories/Processor/Arm/index.html @@ -0,0 +1,99 @@ + + + + + + + + + + + + Arm | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + + + +
+
+ + + + + + + diff --git a/categories/Processor/MIPS/index.html b/categories/Processor/MIPS/index.html new file mode 100644 index 00000000..3e5de1ee --- /dev/null +++ b/categories/Processor/MIPS/index.html @@ -0,0 +1,99 @@ + + + + + + + + + + + + MIPS | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + +
+

2020

+ +
+ +
+
+ + + + + + + diff --git a/categories/Processor/RISC-V/index.html b/categories/Processor/RISC-V/index.html new file mode 100644 index 00000000..3bc6ee82 --- /dev/null +++ b/categories/Processor/RISC-V/index.html @@ -0,0 +1,99 @@ + + + + + + + + + + + + RISC-V | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + +
+

2018

+ +
+ +
+
+ + + + + + + diff --git a/categories/Processor/index.html b/categories/Processor/index.html new file mode 100644 index 00000000..9c118deb --- /dev/null +++ b/categories/Processor/index.html @@ -0,0 +1,124 @@ + + + + + + + + + + + + Processor | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + +
+

2020

+ +
+ + + +
+
+ + + + + + + diff --git a/categories/Programming/API/index.html b/categories/Programming/API/index.html new file mode 100644 index 00000000..749862ba --- /dev/null +++ b/categories/Programming/API/index.html @@ -0,0 +1,115 @@ + + + + + + + + + + + + API | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + +
+

2020

+ +
+ +
+

2019

+ +
+ +
+
+ + + + + + + diff --git a/categories/Programming/C-C/index.html b/categories/Programming/C-C/index.html new file mode 100644 index 00000000..131a65cb --- /dev/null +++ b/categories/Programming/C-C/index.html @@ -0,0 +1,169 @@ + + + + + + + + + + + + C/C++ | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + + + + + +
+
+ + + + + + + diff --git a/categories/Programming/C/index.html b/categories/Programming/C/index.html new file mode 100644 index 00000000..2ea61b28 --- /dev/null +++ b/categories/Programming/C/index.html @@ -0,0 +1,99 @@ + + + + + + + + + + + + C | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + +
+

2021

+ +
+ +
+
+ + + + + + + diff --git a/categories/Programming/CQRS/index.html b/categories/Programming/CQRS/index.html new file mode 100644 index 00000000..31b595b4 --- /dev/null +++ b/categories/Programming/CQRS/index.html @@ -0,0 +1,99 @@ + + + + + + + + + + + + CQRS | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + +
+

2019

+ +
+ +
+
+ + + + + + + diff --git a/categories/Programming/Dart/index.html b/categories/Programming/Dart/index.html new file mode 100644 index 00000000..85dad4f0 --- /dev/null +++ b/categories/Programming/Dart/index.html @@ -0,0 +1,99 @@ + + + + + + + + + + + + Dart | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + +
+

2021

+ +
+ +
+
+ + + + + + + diff --git a/categories/Programming/Git/index.html b/categories/Programming/Git/index.html new file mode 100644 index 00000000..dc62c9ca --- /dev/null +++ b/categories/Programming/Git/index.html @@ -0,0 +1,115 @@ + + + + + + + + + + + + Git | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + +
+

2021

+ +
+ +
+

2019

+ +
+ +
+
+ + + + + + + diff --git a/categories/Programming/HTTP/index.html b/categories/Programming/HTTP/index.html new file mode 100644 index 00000000..0cdeac9c --- /dev/null +++ b/categories/Programming/HTTP/index.html @@ -0,0 +1,115 @@ + + + + + + + + + + + + HTTP | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + +
+

2020

+ +
+ +
+

2019

+ +
+ +
+
+ + + + + + + diff --git a/categories/Programming/Haskell/index.html b/categories/Programming/Haskell/index.html new file mode 100644 index 00000000..450099fa --- /dev/null +++ b/categories/Programming/Haskell/index.html @@ -0,0 +1,117 @@ + + + + + + + + + + + + Haskell | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + +
+

2021

+ +
+ +
+
+ + + + + + + diff --git a/categories/Programming/IDE/index.html b/categories/Programming/IDE/index.html new file mode 100644 index 00000000..77610efd --- /dev/null +++ b/categories/Programming/IDE/index.html @@ -0,0 +1,115 @@ + + + + + + + + + + + + IDE | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + +
+

2020

+ +
+ +
+

2019

+ +
+ +
+
+ + + + + + + diff --git a/categories/Programming/IP/index.html b/categories/Programming/IP/index.html new file mode 100644 index 00000000..1be758ba --- /dev/null +++ b/categories/Programming/IP/index.html @@ -0,0 +1,133 @@ + + + + + + + + + + + + IP | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + +
+

2020

+ +
+ +
+

2019

+ +
+ +
+
+ + + + + + + diff --git a/categories/Programming/JSON/index.html b/categories/Programming/JSON/index.html new file mode 100644 index 00000000..8baf6497 --- /dev/null +++ b/categories/Programming/JSON/index.html @@ -0,0 +1,99 @@ + + + + + + + + + + + + JSON | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + +
+

2019

+ +
+ +
+
+ + + + + + + diff --git a/categories/Programming/Java/index.html b/categories/Programming/Java/index.html new file mode 100644 index 00000000..6f8837be --- /dev/null +++ b/categories/Programming/Java/index.html @@ -0,0 +1,282 @@ + + + + + + + + + + + + Java | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + +
+

2021

+ +
+ +
+

2020

+ +
+ + + +
+

2018

+ +
+ +
+
+ + + + + + + diff --git a/categories/Programming/Julia/index.html b/categories/Programming/Julia/index.html new file mode 100644 index 00000000..6b4d9f41 --- /dev/null +++ b/categories/Programming/Julia/index.html @@ -0,0 +1,108 @@ + + + + + + + + + + + + Julia | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + +
+

2021

+ +
+ +
+
+ + + + + + + diff --git a/categories/Programming/NET/index.html b/categories/Programming/NET/index.html new file mode 100644 index 00000000..d2c6986b --- /dev/null +++ b/categories/Programming/NET/index.html @@ -0,0 +1,115 @@ + + + + + + + + + + + + .NET | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + +
+

2021

+ +
+ +
+

2020

+ +
+ +
+
+ + + + + + + diff --git a/categories/Programming/NewSQL/index.html b/categories/Programming/NewSQL/index.html new file mode 100644 index 00000000..f979537f --- /dev/null +++ b/categories/Programming/NewSQL/index.html @@ -0,0 +1,99 @@ + + + + + + + + + + + + NewSQL | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + +
+

2018

+ +
+ +
+
+ + + + + + + diff --git a/categories/Programming/Python/index.html b/categories/Programming/Python/index.html new file mode 100644 index 00000000..5ef584bd --- /dev/null +++ b/categories/Programming/Python/index.html @@ -0,0 +1,133 @@ + + + + + + + + + + + + Python | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + +
+

2021

+ +
+ + + +
+
+ + + + + + + diff --git a/categories/Programming/Rust/index.html b/categories/Programming/Rust/index.html new file mode 100644 index 00000000..e19d6220 --- /dev/null +++ b/categories/Programming/Rust/index.html @@ -0,0 +1,133 @@ + + + + + + + + + + + + Rust | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + + + +
+

2020

+ +
+ +
+
+ + + + + + + diff --git a/categories/Programming/SQL/index.html b/categories/Programming/SQL/index.html new file mode 100644 index 00000000..958ba2d7 --- /dev/null +++ b/categories/Programming/SQL/index.html @@ -0,0 +1,142 @@ + + + + + + + + + + + + SQL | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + +
+

2020

+ +
+ +
+

2019

+ +
+ +
+
+ + + + + + + diff --git a/categories/Programming/Zig/index.html b/categories/Programming/Zig/index.html new file mode 100644 index 00000000..b00cfc5f --- /dev/null +++ b/categories/Programming/Zig/index.html @@ -0,0 +1,99 @@ + + + + + + + + + + + + Zig | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + +
+

2020

+ +
+ +
+
+ + + + + + + diff --git a/categories/Programming/index.html b/categories/Programming/index.html new file mode 100644 index 00000000..537140d1 --- /dev/null +++ b/categories/Programming/index.html @@ -0,0 +1,730 @@ + + + + + + + + + + + + Programming | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + + + + + + + + + +
+

2018

+ +
+ +
+
+ + + + + + + diff --git a/categories/Trends/Industry/index.html b/categories/Trends/Industry/index.html new file mode 100644 index 00000000..41a2ae32 --- /dev/null +++ b/categories/Trends/Industry/index.html @@ -0,0 +1,115 @@ + + + + + + + + + + + + Industry | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + + + +
+

2018

+ +
+ +
+
+ + + + + + + diff --git a/categories/Trends/Lean/index.html b/categories/Trends/Lean/index.html new file mode 100644 index 00000000..2e8da267 --- /dev/null +++ b/categories/Trends/Lean/index.html @@ -0,0 +1,99 @@ + + + + + + + + + + + + Lean | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + +
+

2019

+ +
+ +
+
+ + + + + + + diff --git a/categories/Trends/Management/index.html b/categories/Trends/Management/index.html new file mode 100644 index 00000000..bae47b8a --- /dev/null +++ b/categories/Trends/Management/index.html @@ -0,0 +1,99 @@ + + + + + + + + + + + + Management | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + +
+

2019

+ +
+ +
+
+ + + + + + + diff --git a/categories/Trends/SCM/index.html b/categories/Trends/SCM/index.html new file mode 100644 index 00000000..69ae9e58 --- /dev/null +++ b/categories/Trends/SCM/index.html @@ -0,0 +1,99 @@ + + + + + + + + + + + + SCM | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + +
+

2018

+ +
+ +
+
+ + + + + + + diff --git a/categories/Trends/index.html b/categories/Trends/index.html new file mode 100644 index 00000000..dd812a34 --- /dev/null +++ b/categories/Trends/index.html @@ -0,0 +1,219 @@ + + + + + + + + + + + + Trends | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + + + +
+

2020

+ +
+ + + +
+

2018

+ +
+ +
+
+ + + + + + + diff --git a/categories/Utility/Security/index.html b/categories/Utility/Security/index.html new file mode 100644 index 00000000..e66e92da --- /dev/null +++ b/categories/Utility/Security/index.html @@ -0,0 +1,108 @@ + + + + + + + + + + + + Security | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + + + +
+
+ + + + + + + diff --git a/categories/Utility/index.html b/categories/Utility/index.html new file mode 100644 index 00000000..87047b89 --- /dev/null +++ b/categories/Utility/index.html @@ -0,0 +1,108 @@ + + + + + + + + + + + + Utility | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ + + + +
+
+ + + + + + + diff --git a/categories/index.html b/categories/index.html new file mode 100644 index 00000000..fb3e9457 --- /dev/null +++ b/categories/index.html @@ -0,0 +1,103 @@ + + + + + + + + + + + + 分类 | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+
+
+

+ 分类 +

+ + +
+
+ + +
+ +
+ + + + + + + + + diff --git a/index.html b/index.html new file mode 100644 index 00000000..ed8661a0 --- /dev/null +++ b/index.html @@ -0,0 +1,4398 @@ + + + + + + + + + + + + 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+
+ + +
+
+ +
+
+ +
+ +

+ Rust project promote the wasm32-wasip2 target to Tier 2 +

+
+ +
+ + Rust project promote the wasm32-wasip2 target to Tier 2 + +
+ +
+ +
+ +

+ OpenSSH Login with GnuPG (OpenPGP) Keys +

+
+ +
+ + OpenSSH Login with GnuPG (OpenPGP) Keys + +
+ +
+ +
+ +

+ Post-Quantum Cryptography in OpenPGP +

+
+ +
+ + Post-Quantum Cryptography in OpenPGP + +
+ +
+ +
+ +

+ Run Linux GUI Programs With WSLg Through OCI Image +

+
+ +
+ + Run Linux GUI Programs With WSLg Through OCI Image + +
+ +
+ +
+ +

+ GTK User Configuration +

+
+ +
+ + GTK User Configuration + +
+ +
+ +
+ +

+ Console Based Gmail Client +

+
+ +
+ + Console Based Gmail Client + +
+ +
+ +
+ +

+ Compiling the Linux Kernel for WSL2 +

+
+ +
+ + Compiling the Linux Kernel for WSL2 + +
+ +
+ +
+ +

+ FreeBSD Hypervisor: bhyve +

+
+ +
+ + FreeBSD Hypervisor: bhyve + +
+ +
+ +
+ +

+ Fused Multiply-Add (FMA) +

+
+ +
+ + Fused Multiply-Add (FMA) + +
+ +
+ +
+ +

+ Linux Home and End Keys +

+
+ +
+ + Linux Home and End Keys + +
+ +
+ +
+ +

+ Linux Unified Key Setup +

+
+ +
+ + Linux Unified Key Setup + +
+ +
+ +
+ +

+ Nested virtualization +

+
+ +
+ + Nested virtualization + +
+ +
+ +
+ +

+ How to Mount QEMU Disk Image +

+
+ +
+ + How to Mount QEMU Disk Image + +
+ +
+ +
+ +

+ Cross-build NetBSD Program in Linux +

+
+ +
+ + Cross-build NetBSD Program in Linux + +
+ +
+ +
+ +

+ Cross-build FreeBSD Program in Linux +

+
+ +
+ + Cross-build FreeBSD Program in Linux + +
+ +
+ +
+ +

+ Alpine 3.14 on WSL2 +

+
+ +
+ + Alpine 3.14 on WSL2 + +
+ +
+ +
+ +

+ Windows Server 2022 generally available +

+
+ +
+ + Windows Server 2022 generally available + +
+ +
+ +
+ +

+ Spring Native: What, Why and How +

+
+ +
+ + Spring Native: What, Why and How + +
+ +
+ +
+ +

+ HikariCP and PostgreSQL +

+
+ +
+ + HikariCP and PostgreSQL + +
+ +
+ +
+ +

+ SCTP over UDP in the Linux kernel +

+
+ +
+ + SCTP over UDP in the Linux kernel + +
+ +
+ +
+ +

+ Visualization with Matplotlib +

+
+ +
+ + Visualization with Matplotlib + +
+ +
+ +
+ +

+ Getting the Git Timing Right +

+
+ +
+ + Getting the Git Timing Right + +
+ +
+ +
+ +

+ OpenMP 5.1 with Vital Usability Enhancements +

+
+ +
+ + OpenMP 5.1 with Vital Usability Enhancements + +
+ +
+ +
+ +

+ REST API backend by Julia with Genie +

+
+ +
+ + REST API backend by Julia with Genie + +
+ +
+ +
+ +

+ Julia Data Types +

+
+ +
+ + Julia Data Types + +
+ +
+ +
+ +

+ Benefits of Learning Haskell +

+
+ +
+ + Benefits of Learning Haskell + +
+ +
+ +
+ +

+ Prometheus Query Language +

+
+ +
+ + Prometheus Query Language + +
+ +
+ +
+ +

+ .NET on Linux +

+
+ +
+ + .NET on Linux + +
+ +
+ +
+ +

+ Time of Haskell +

+
+ +
+ + Time of Haskell + +
+ +
+ +
+ +

+ Dart programming language +

+
+ +
+ + Dart programming language + +
+ +
+ +
+ +

+ Microservices Architecture Principles +

+
+ +
+ + Microservices Architecture Principles + +
+ +
+ +
+ +

+ SOLID Principles +

+
+ +
+ + SOLID Principles + +
+ +
+ +
+ +

+ Statically Linked Executable Hardening with PIE +

+
+ +
+ + Statically Linked Executable Hardening with PIE + +
+ +
+ +
+ +

+ Cross compiling Rust and Running with QEMU or Wine +

+
+ +
+ + Cross compiling Rust and Running with QEMU or Wine + +
+ +
+ +
+ +

+ Cross compiling Rust for Windows MSVC target +

+
+ +
+ + Cross compiling Rust for Windows MSVC target + +
+ +
+ +
+ +

+ Haskell Programming Language +

+
+ +
+ + Haskell Programming Language + +
+ +
+ +
+ +

+ FreeBSD 13 Summary +

+
+ +
+ + FreeBSD 13 Summary + +
+ +
+ +
+ +

+ Scrum Guide 2020 +

+
+ +
+ + Scrum Guide 2020 + +
+ +
+ +
+ +

+ 20 Must-Have Skills for Software Developers in 2021 +

+
+ +
+ + 20 Must-Have Skills for Software Developers in 2021 + +
+ +
+ +
+ +

+ Ubuntu 20.04 armhf on Raspberry Pi 3B+ +

+
+ +
+ + Ubuntu 20.04 armhf on Raspberry Pi 3B+ + +
+ +
+ +
+ +

+ Ubuntu 20.04 arm64 on Raspberry Pi 3B+ +

+
+ +
+ + Ubuntu 20.04 arm64 on Raspberry Pi 3B+ + +
+ +
+ +
+ +

+ FreeBSD 12 arm64 on Raspberry Pi 3B+ +

+
+ +
+ + FreeBSD 12 arm64 on Raspberry Pi 3B+ + +
+ +
+ +
+ +

+ OpenBSD 6.8 arm64 on Raspberry Pi 3B+ +

+
+ +
+ + OpenBSD 6.8 arm64 on Raspberry Pi 3B+ + +
+ +
+ +
+ +

+ NetBSD 9 aarch64 on Raspberry Pi 3B+ +

+
+ +
+ + NetBSD 9 aarch64 on Raspberry Pi 3B+ + +
+ +
+ +
+ +

+ NetBSD 9 armv7hf on Raspberry Pi 3B+ +

+
+ +
+ + NetBSD 9 armv7hf on Raspberry Pi 3B+ + +
+ +
+ +
+ +

+ NetBSD 9 armv6hf on Raspberry Pi 3B+ +

+
+ +
+ + NetBSD 9 armv6hf on Raspberry Pi 3B+ + +
+ +
+ +
+ +

+ NetBSD 9 on Raspberry Pi Zero +

+
+ +
+ + NetBSD 9 on Raspberry Pi Zero + +
+ +
+ +
+ +

+ FreeBSD 12 on Raspberry Pi Zero +

+
+ +
+ + FreeBSD 12 on Raspberry Pi Zero + +
+ +
+ +
+ +

+ Realtek RTL8761B based Bluetooth adapter +

+
+ +
+ + Realtek RTL8761B based Bluetooth adapter + +
+ +
+ +
+ +

+ USB to TTL - CH340 +

+
+ +
+ + USB to TTL - CH340 + +
+ +
+ +
+ +

+ WireGuard on Raspberry Pi +

+
+ +
+ + WireGuard on Raspberry Pi + +
+ +
+ +
+ +

+ Multicast DNS (mDNS) +

+
+ +
+ + Multicast DNS (mDNS) + +
+ +
+ +
+ +

+ Realtek RTL8152 Based USB Ethernet Adapter +

+
+ +
+ + Realtek RTL8152 Based USB Ethernet Adapter + +
+ +
+ +
+ +

+ SDXC card SD64G on Raspberry Pi +

+
+ +
+ + SDXC card SD64G on Raspberry Pi + +
+ +
+ +
+ +

+ Zig Programming Language Quick Start +

+
+ +
+ + Zig Programming Language Quick Start + +
+ +
+ +
+ +

+ SSH Proxy and Forwarding +

+
+ +
+ + SSH Proxy and Forwarding + +
+ +
+ +
+ +

+ Build Boost on Windows +

+
+ +
+ + Build Boost on Windows + +
+ +
+ +
+ +

+ Quickly generate certificates by OpenSSL +

+
+ +
+ + Quickly generate certificates by OpenSSL + +
+ +
+ +
+ +

+ ASGI: Async Python Web Ecosystem +

+
+ +
+ + ASGI: Async Python Web Ecosystem + +
+ +
+ +
+ +

+ Quickly deploy OCI images to Kubernetes +

+
+ +
+ + Quickly deploy OCI images to Kubernetes + +
+ +
+ +
+ +

+ Welcome to Cython +

+
+ +
+ + Welcome to Cython + +
+ +
+ +
+ +

+ Build BusyBox in Docker +

+
+ +
+ + Build BusyBox in Docker + +
+ +
+ +
+ +

+ Rsync backup for Android device +

+
+ +
+ + Rsync backup for Android device + +
+ +
+ +
+ +

+ Compile rsync by NDK +

+
+ +
+ + Compile rsync by NDK + +
+ +
+ +
+ +

+ NDK console program +

+
+ +
+ + NDK console program + +
+ +
+ +
+ +

+ Cargo Source Replacement +

+
+ +
+ + Cargo Source Replacement + +
+ +
+ +
+ +

+ Open source mirrors +

+
+ +
+ + Open source mirrors + +
+ +
+ +
+ +

+ Performance of ZooKeeper Lock +

+
+ +
+ + Performance of ZooKeeper Lock + +
+ +
+ +
+ +

+ .NET Core Life Cycle +

+
+ +
+ + .NET Core Life Cycle + +
+ +
+ +
+ +

+ Get Started Flyway in 5 minutes +

+
+ +
+ + Get Started Flyway in 5 minutes + +
+ +
+ +
+ +

+ Vultr API Quickstart +

+
+ +
+ + Vultr API Quickstart + +
+ +
+ +
+ +

+ Synchronization of Windows Clocks +

+
+ +
+ + Synchronization of Windows Clocks + +
+ +
+ +
+ +

+ Synchronization of Linux clocks +

+
+ +
+ + Synchronization of Linux clocks + +
+ +
+ +
+ +

+ Containers for development +

+
+ +
+ + Containers for development + +
+ +
+ +
+ +

+ How to set up a WebDAV share with Nginx +

+
+ +
+ + How to set up a WebDAV share with Nginx + +
+ +
+ +
+ +

+ APT configuration and Preference +

+
+ +
+ + APT configuration and Preference + +
+ +
+ +
+ +

+ Running a Container With a Non Root User +

+
+ +
+ + Running a Container With a Non Root User + +
+ +
+ +
+ +

+ USB Bluetooth Adaper +

+
+ +
+ + USB Bluetooth Adaper + +
+ +
+ +
+ +

+ MIPS Processors +

+
+ +
+ + MIPS Processors + +
+ +
+ +
+ +

+ aria2 default configuration file +

+
+ +
+ + aria2 default configuration file + +
+ +
+ +
+ +

+ Linux Kernel and GNU C Library version of common Linux distributions +

+
+ +
+ + Linux Kernel and GNU C Library version of common Linux distributions + +
+ +
+ +
+ +

+ Life cycle of common Linux distributions +

+
+ +
+ + Life cycle of common Linux distributions + +
+ +
+ +
+ +

+ Speed up apt installation or upgrade +

+
+ +
+ + Speed up apt installation or upgrade + +
+ +
+ +
+ +

+ nftables load balancer +

+
+ +
+ + nftables load balancer + +
+ +
+ +
+ +

+ CentOS 8 Stream +

+
+ +
+ + CentOS 8 Stream + +
+ +
+ +
+ +

+ Disk bandwidth utilization +

+
+ +
+ + Disk bandwidth utilization + +
+ +
+ +
+ +

+ Wi-Fi MAC addres Randomization +

+
+ +
+ + Wi-Fi MAC addres Randomization + +
+ +
+ +
+ +

+ Controlling NetworkManager - nmcli +

+
+ +
+ + Controlling NetworkManager - nmcli + +
+ +
+ +
+ +

+ go-ipfs 0.4.23 released +

+
+ +
+ + go-ipfs 0.4.23 released + +
+ +
+ +
+ +

+ GPT Partition +

+
+ +
+ + GPT Partition + +
+ +
+ +
+ +

+ Setup SSH SOCKS5 proxy for Chrome +

+
+ +
+ + Setup SSH SOCKS5 proxy for Chrome + +
+ +
+ +
+ +

+ Rust installation +

+
+ +
+ + Rust installation + +
+ +
+ +
+ +

+ Linux Desktop Entry +

+
+ +
+ + Linux Desktop Entry + +
+ +
+ +
+ +

+ pg metrics +

+
+ +
+ + pg metrics + +
+ +
+ +
+ +

+ RxJava 3 +

+
+ +
+ + RxJava 3 + +
+ +
+ +
+ +

+ List and Install VSCode Extensions +

+
+ +
+ + List and Install VSCode Extensions + +
+ +
+ +
+ +

+ How to flush output of Python print function +

+
+ +
+ + How to flush output of Python print function + +
+ +
+ +
+ +

+ Java Offset DateTime Formatter +

+
+ +
+ + Java Offset DateTime Formatter + +
+ +
+ +
+ +

+ SQL insert on conflict +

+
+ +
+ + SQL insert on conflict + +
+ +
+ +
+ +

+ WireGuard - Next Generation Network Tunnel +

+
+ +
+ + WireGuard - Next Generation Network Tunnel + +
+ +
+ +
+ +
+ +
+
+ +
+ + +
+ Next +
+ +
+
+ + + + + + + + + diff --git a/placeholder b/js/script.js similarity index 100% rename from placeholder rename to js/script.js diff --git a/lib/ScrollMagic.min.js b/lib/ScrollMagic.min.js new file mode 100644 index 00000000..cc15c4d8 --- /dev/null +++ b/lib/ScrollMagic.min.js @@ -0,0 +1,2 @@ +/*! ScrollMagic v2.0.6 | (c) 2018 Jan Paepke (@janpaepke) | license & info: http://scrollmagic.io */ +!function(e,t){"function"==typeof define&&define.amd?define(t):"object"==typeof exports?module.exports=t():e.ScrollMagic=t()}(this,function(){"use strict";var e=function(){};e.version="2.0.6",window.addEventListener("mousewheel",function(){});var t="data-scrollmagic-pin-spacer";e.Controller=function(r){var o,s,a="ScrollMagic.Controller",l="FORWARD",c="REVERSE",f="PAUSED",u=n.defaults,d=this,h=i.extend({},u,r),g=[],p=!1,v=0,m=f,w=!0,y=0,S=!0,b=function(){for(var e in h)u.hasOwnProperty(e)||delete h[e];if(h.container=i.get.elements(h.container)[0],!h.container)throw a+" init failed.";w=h.container===window||h.container===document.body||!document.body.contains(h.container),w&&(h.container=window),y=z(),h.container.addEventListener("resize",T),h.container.addEventListener("scroll",T);var t=parseInt(h.refreshInterval,10);h.refreshInterval=i.type.Number(t)?t:u.refreshInterval,E()},E=function(){h.refreshInterval>0&&(s=window.setTimeout(A,h.refreshInterval))},x=function(){return h.vertical?i.get.scrollTop(h.container):i.get.scrollLeft(h.container)},z=function(){return h.vertical?i.get.height(h.container):i.get.width(h.container)},C=this._setScrollPos=function(e){h.vertical?w?window.scrollTo(i.get.scrollLeft(),e):h.container.scrollTop=e:w?window.scrollTo(e,i.get.scrollTop()):h.container.scrollLeft=e},F=function(){if(S&&p){var e=i.type.Array(p)?p:g.slice(0);p=!1;var t=v;v=d.scrollPos();var n=v-t;0!==n&&(m=n>0?l:c),m===c&&e.reverse(),e.forEach(function(e){e.update(!0)})}},L=function(){o=i.rAF(F)},T=function(e){"resize"==e.type&&(y=z(),m=f),p!==!0&&(p=!0,L())},A=function(){if(!w&&y!=z()){var e;try{e=new Event("resize",{bubbles:!1,cancelable:!1})}catch(t){e=document.createEvent("Event"),e.initEvent("resize",!1,!1)}h.container.dispatchEvent(e)}g.forEach(function(e){e.refresh()}),E()};this._options=h;var N=function(e){if(e.length<=1)return e;var t=e.slice(0);return t.sort(function(e,t){return e.scrollOffset()>t.scrollOffset()?1:-1}),t};return this.addScene=function(t){if(i.type.Array(t))t.forEach(function(e){d.addScene(e)});else if(t instanceof e.Scene)if(t.controller()!==d)t.addTo(d);else if(g.indexOf(t)<0){g.push(t),g=N(g),t.on("shift.controller_sort",function(){g=N(g)});for(var n in h.globalSceneOptions)t[n]&&t[n].call(t,h.globalSceneOptions[n])}return d},this.removeScene=function(e){if(i.type.Array(e))e.forEach(function(e){d.removeScene(e)});else{var t=g.indexOf(e);t>-1&&(e.off("shift.controller_sort"),g.splice(t,1),e.remove())}return d},this.updateScene=function(t,n){return i.type.Array(t)?t.forEach(function(e){d.updateScene(e,n)}):n?t.update(!0):p!==!0&&t instanceof e.Scene&&(p=p||[],-1==p.indexOf(t)&&p.push(t),p=N(p),L()),d},this.update=function(e){return T({type:"resize"}),e&&F(),d},this.scrollTo=function(n,r){if(i.type.Number(n))C.call(h.container,n,r);else if(n instanceof e.Scene)n.controller()===d&&d.scrollTo(n.scrollOffset(),r);else if(i.type.Function(n))C=n;else{var o=i.get.elements(n)[0];if(o){for(;o.parentNode.hasAttribute(t);)o=o.parentNode;var s=h.vertical?"top":"left",a=i.get.offset(h.container),l=i.get.offset(o);w||(a[s]-=d.scrollPos()),d.scrollTo(l[s]-a[s],r)}}return d},this.scrollPos=function(e){return arguments.length?(i.type.Function(e)&&(x=e),d):x.call(d)},this.info=function(e){var t={size:y,vertical:h.vertical,scrollPos:v,scrollDirection:m,container:h.container,isDocument:w};return arguments.length?void 0!==t[e]?t[e]:void 0:t},this.loglevel=function(){return d},this.enabled=function(e){return arguments.length?(S!=e&&(S=!!e,d.updateScene(g,!0)),d):S},this.destroy=function(e){window.clearTimeout(s);for(var t=g.length;t--;)g[t].destroy(e);return h.container.removeEventListener("resize",T),h.container.removeEventListener("scroll",T),i.cAF(o),null},b(),d};var n={defaults:{container:window,vertical:!0,globalSceneOptions:{},loglevel:2,refreshInterval:100}};e.Controller.addOption=function(e,t){n.defaults[e]=t},e.Controller.extend=function(t){var n=this;e.Controller=function(){return n.apply(this,arguments),this.$super=i.extend({},this),t.apply(this,arguments)||this},i.extend(e.Controller,n),e.Controller.prototype=n.prototype,e.Controller.prototype.constructor=e.Controller},e.Scene=function(n){var o,s,a="BEFORE",l="DURING",c="AFTER",f=r.defaults,u=this,d=i.extend({},f,n),h=a,g=0,p={start:0,end:0},v=0,m=!0,w=function(){for(var e in d)f.hasOwnProperty(e)||delete d[e];for(var t in f)L(t);C()},y={};this.on=function(e,t){return i.type.Function(t)&&(e=e.trim().split(" "),e.forEach(function(e){var n=e.split("."),r=n[0],i=n[1];"*"!=r&&(y[r]||(y[r]=[]),y[r].push({namespace:i||"",callback:t}))})),u},this.off=function(e,t){return e?(e=e.trim().split(" "),e.forEach(function(e){var n=e.split("."),r=n[0],i=n[1]||"",o="*"===r?Object.keys(y):[r];o.forEach(function(e){for(var n=y[e]||[],r=n.length;r--;){var o=n[r];!o||i!==o.namespace&&"*"!==i||t&&t!=o.callback||n.splice(r,1)}n.length||delete y[e]})}),u):u},this.trigger=function(t,n){if(t){var r=t.trim().split("."),i=r[0],o=r[1],s=y[i];s&&s.forEach(function(t){o&&o!==t.namespace||t.callback.call(u,new e.Event(i,t.namespace,u,n))})}return u},u.on("change.internal",function(e){"loglevel"!==e.what&&"tweenChanges"!==e.what&&("triggerElement"===e.what?E():"reverse"===e.what&&u.update())}).on("shift.internal",function(){S(),u.update()}),this.addTo=function(t){return t instanceof e.Controller&&s!=t&&(s&&s.removeScene(u),s=t,C(),b(!0),E(!0),S(),s.info("container").addEventListener("resize",x),t.addScene(u),u.trigger("add",{controller:s}),u.update()),u},this.enabled=function(e){return arguments.length?(m!=e&&(m=!!e,u.update(!0)),u):m},this.remove=function(){if(s){s.info("container").removeEventListener("resize",x);var e=s;s=void 0,e.removeScene(u),u.trigger("remove")}return u},this.destroy=function(e){return u.trigger("destroy",{reset:e}),u.remove(),u.off("*.*"),null},this.update=function(e){if(s)if(e)if(s.enabled()&&m){var t,n=s.info("scrollPos");t=d.duration>0?(n-p.start)/(p.end-p.start):n>=p.start?1:0,u.trigger("update",{startPos:p.start,endPos:p.end,scrollPos:n}),u.progress(t)}else T&&h===l&&N(!0);else s.updateScene(u,!1);return u},this.refresh=function(){return b(),E(),u},this.progress=function(e){if(arguments.length){var t=!1,n=h,r=s?s.info("scrollDirection"):"PAUSED",i=d.reverse||e>=g;if(0===d.duration?(t=g!=e,g=1>e&&i?0:1,h=0===g?a:l):0>e&&h!==a&&i?(g=0,h=a,t=!0):e>=0&&1>e&&i?(g=e,h=l,t=!0):e>=1&&h!==c?(g=1,h=c,t=!0):h!==l||i||N(),t){var o={progress:g,state:h,scrollDirection:r},f=h!=n,p=function(e){u.trigger(e,o)};f&&n!==l&&(p("enter"),p(n===a?"start":"end")),p("progress"),f&&h!==l&&(p(h===a?"start":"end"),p("leave"))}return u}return g};var S=function(){p={start:v+d.offset},s&&d.triggerElement&&(p.start-=s.info("size")*d.triggerHook),p.end=p.start+d.duration},b=function(e){if(o){var t="duration";F(t,o.call(u))&&!e&&(u.trigger("change",{what:t,newval:d[t]}),u.trigger("shift",{reason:t}))}},E=function(e){var n=0,r=d.triggerElement;if(s&&(r||v>0)){if(r)if(r.parentNode){for(var o=s.info(),a=i.get.offset(o.container),l=o.vertical?"top":"left";r.parentNode.hasAttribute(t);)r=r.parentNode;var c=i.get.offset(r);o.isDocument||(a[l]-=s.scrollPos()),n=c[l]-a[l]}else u.triggerElement(void 0);var f=n!=v;v=n,f&&!e&&u.trigger("shift",{reason:"triggerElementPosition"})}},x=function(){d.triggerHook>0&&u.trigger("shift",{reason:"containerResize"})},z=i.extend(r.validate,{duration:function(e){if(i.type.String(e)&&e.match(/^(\.|\d)*\d+%$/)){var t=parseFloat(e)/100;e=function(){return s?s.info("size")*t:0}}if(i.type.Function(e)){o=e;try{e=parseFloat(o())}catch(n){e=-1}}if(e=parseFloat(e),!i.type.Number(e)||0>e)throw o?(o=void 0,0):0;return e}}),C=function(e){e=arguments.length?[e]:Object.keys(z),e.forEach(function(e){var t;if(z[e])try{t=z[e](d[e])}catch(n){t=f[e]}finally{d[e]=t}})},F=function(e,t){var n=!1,r=d[e];return d[e]!=t&&(d[e]=t,C(e),n=r!=d[e]),n},L=function(e){u[e]||(u[e]=function(t){return arguments.length?("duration"===e&&(o=void 0),F(e,t)&&(u.trigger("change",{what:e,newval:d[e]}),r.shifts.indexOf(e)>-1&&u.trigger("shift",{reason:e})),u):d[e]})};this.controller=function(){return s},this.state=function(){return h},this.scrollOffset=function(){return p.start},this.triggerPosition=function(){var e=d.offset;return s&&(e+=d.triggerElement?v:s.info("size")*u.triggerHook()),e};var T,A;u.on("shift.internal",function(e){var t="duration"===e.reason;(h===c&&t||h===l&&0===d.duration)&&N(),t&&O()}).on("progress.internal",function(){N()}).on("add.internal",function(){O()}).on("destroy.internal",function(e){u.removePin(e.reset)});var N=function(e){if(T&&s){var t=s.info(),n=A.spacer.firstChild;if(e||h!==l){var r={position:A.inFlow?"relative":"absolute",top:0,left:0},o=i.css(n,"position")!=r.position;A.pushFollowers?d.duration>0&&(h===c&&0===parseFloat(i.css(A.spacer,"padding-top"))?o=!0:h===a&&0===parseFloat(i.css(A.spacer,"padding-bottom"))&&(o=!0)):r[t.vertical?"top":"left"]=d.duration*g,i.css(n,r),o&&O()}else{"fixed"!=i.css(n,"position")&&(i.css(n,{position:"fixed"}),O());var f=i.get.offset(A.spacer,!0),u=d.reverse||0===d.duration?t.scrollPos-p.start:Math.round(g*d.duration*10)/10;f[t.vertical?"top":"left"]+=u,i.css(A.spacer.firstChild,{top:f.top,left:f.left})}}},O=function(){if(T&&s&&A.inFlow){var e=h===l,t=s.info("vertical"),n=A.spacer.firstChild,r=i.isMarginCollapseType(i.css(A.spacer,"display")),o={};A.relSize.width||A.relSize.autoFullWidth?e?i.css(T,{width:i.get.width(A.spacer)}):i.css(T,{width:"100%"}):(o["min-width"]=i.get.width(t?T:n,!0,!0),o.width=e?o["min-width"]:"auto"),A.relSize.height?e?i.css(T,{height:i.get.height(A.spacer)-(A.pushFollowers?d.duration:0)}):i.css(T,{height:"100%"}):(o["min-height"]=i.get.height(t?n:T,!0,!r),o.height=e?o["min-height"]:"auto"),A.pushFollowers&&(o["padding"+(t?"Top":"Left")]=d.duration*g,o["padding"+(t?"Bottom":"Right")]=d.duration*(1-g)),i.css(A.spacer,o)}},_=function(){s&&T&&h===l&&!s.info("isDocument")&&N()},P=function(){s&&T&&h===l&&((A.relSize.width||A.relSize.autoFullWidth)&&i.get.width(window)!=i.get.width(A.spacer.parentNode)||A.relSize.height&&i.get.height(window)!=i.get.height(A.spacer.parentNode))&&O()},D=function(e){s&&T&&h===l&&!s.info("isDocument")&&(e.preventDefault(),s._setScrollPos(s.info("scrollPos")-((e.wheelDelta||e[s.info("vertical")?"wheelDeltaY":"wheelDeltaX"])/3||30*-e.detail)))};this.setPin=function(e,n){var r={pushFollowers:!0,spacerClass:"scrollmagic-pin-spacer"};if(n=i.extend({},r,n),e=i.get.elements(e)[0],!e)return u;if("fixed"===i.css(e,"position"))return u;if(T){if(T===e)return u;u.removePin()}T=e;var o=T.parentNode.style.display,s=["top","left","bottom","right","margin","marginLeft","marginRight","marginTop","marginBottom"];T.parentNode.style.display="none";var a="absolute"!=i.css(T,"position"),l=i.css(T,s.concat(["display"])),c=i.css(T,["width","height"]);T.parentNode.style.display=o,!a&&n.pushFollowers&&(n.pushFollowers=!1);var f=T.parentNode.insertBefore(document.createElement("div"),T),d=i.extend(l,{position:a?"relative":"absolute",boxSizing:"content-box",mozBoxSizing:"content-box",webkitBoxSizing:"content-box"});if(a||i.extend(d,i.css(T,["width","height"])),i.css(f,d),f.setAttribute(t,""),i.addClass(f,n.spacerClass),A={spacer:f,relSize:{width:"%"===c.width.slice(-1),height:"%"===c.height.slice(-1),autoFullWidth:"auto"===c.width&&a&&i.isMarginCollapseType(l.display)},pushFollowers:n.pushFollowers,inFlow:a},!T.___origStyle){T.___origStyle={};var h=T.style,g=s.concat(["width","height","position","boxSizing","mozBoxSizing","webkitBoxSizing"]);g.forEach(function(e){T.___origStyle[e]=h[e]||""})}return A.relSize.width&&i.css(f,{width:c.width}),A.relSize.height&&i.css(f,{height:c.height}),f.appendChild(T),i.css(T,{position:a?"relative":"absolute",margin:"auto",top:"auto",left:"auto",bottom:"auto",right:"auto"}),(A.relSize.width||A.relSize.autoFullWidth)&&i.css(T,{boxSizing:"border-box",mozBoxSizing:"border-box",webkitBoxSizing:"border-box"}),window.addEventListener("scroll",_),window.addEventListener("resize",_),window.addEventListener("resize",P),T.addEventListener("mousewheel",D),T.addEventListener("DOMMouseScroll",D),N(),u},this.removePin=function(e){if(T){if(h===l&&N(!0),e||!s){var n=A.spacer.firstChild;if(n.hasAttribute(t)){var r=A.spacer.style,o=["margin","marginLeft","marginRight","marginTop","marginBottom"],a={};o.forEach(function(e){a[e]=r[e]||""}),i.css(n,a)}A.spacer.parentNode.insertBefore(n,A.spacer),A.spacer.parentNode.removeChild(A.spacer),T.parentNode.hasAttribute(t)||(i.css(T,T.___origStyle),delete T.___origStyle)}window.removeEventListener("scroll",_),window.removeEventListener("resize",_),window.removeEventListener("resize",P),T.removeEventListener("mousewheel",D),T.removeEventListener("DOMMouseScroll",D),T=void 0}return u};var R,k=[];return u.on("destroy.internal",function(e){u.removeClassToggle(e.reset)}),this.setClassToggle=function(e,t){var n=i.get.elements(e);return 0!==n.length&&i.type.String(t)?(k.length>0&&u.removeClassToggle(),R=t,k=n,u.on("enter.internal_class leave.internal_class",function(e){var t="enter"===e.type?i.addClass:i.removeClass;k.forEach(function(e){t(e,R)})}),u):u},this.removeClassToggle=function(e){return e&&k.forEach(function(e){i.removeClass(e,R)}),u.off("start.internal_class end.internal_class"),R=void 0,k=[],u},w(),u};var r={defaults:{duration:0,offset:0,triggerElement:void 0,triggerHook:.5,reverse:!0,loglevel:2},validate:{offset:function(e){if(e=parseFloat(e),!i.type.Number(e))throw 0;return e},triggerElement:function(e){if(e=e||void 0){var t=i.get.elements(e)[0];if(!t||!t.parentNode)throw 0;e=t}return e},triggerHook:function(e){var t={onCenter:.5,onEnter:1,onLeave:0};if(i.type.Number(e))e=Math.max(0,Math.min(parseFloat(e),1));else{if(!(e in t))throw 0;e=t[e]}return e},reverse:function(e){return!!e}},shifts:["duration","offset","triggerHook"]};e.Scene.addOption=function(e,t,n,i){e in r.defaults||(r.defaults[e]=t,r.validate[e]=n,i&&r.shifts.push(e))},e.Scene.extend=function(t){var n=this;e.Scene=function(){return n.apply(this,arguments),this.$super=i.extend({},this),t.apply(this,arguments)||this},i.extend(e.Scene,n),e.Scene.prototype=n.prototype,e.Scene.prototype.constructor=e.Scene},e.Event=function(e,t,n,r){r=r||{};for(var i in r)this[i]=r[i];return this.type=e,this.target=this.currentTarget=n,this.namespace=t||"",this.timeStamp=this.timestamp=Date.now(),this};var i=e._util=function(e){var t,n={},r=function(e){return parseFloat(e)||0},i=function(t){return t.currentStyle?t.currentStyle:e.getComputedStyle(t)},o=function(t,n,o,s){if(n=n===document?e:n,n===e)s=!1;else if(!u.DomElement(n))return 0;t=t.charAt(0).toUpperCase()+t.substr(1).toLowerCase();var a=(o?n["offset"+t]||n["outer"+t]:n["client"+t]||n["inner"+t])||0;if(o&&s){var l=i(n);a+="Height"===t?r(l.marginTop)+r(l.marginBottom):r(l.marginLeft)+r(l.marginRight)}return a},s=function(e){return e.replace(/^[^a-z]+([a-z])/g,"$1").replace(/-([a-z])/g,function(e){return e[1].toUpperCase()})};n.extend=function(e){for(e=e||{},t=1;t-1};var a=0,l=["ms","moz","webkit","o"],c=e.requestAnimationFrame,f=e.cancelAnimationFrame;for(t=0;!c&&t=0},u.DomElement=function(e){return"object"==typeof HTMLElement?e instanceof HTMLElement:e&&"object"==typeof e&&null!==e&&1===e.nodeType&&"string"==typeof e.nodeName};var d=n.get={};return d.elements=function(t){var n=[];if(u.String(t))try{t=document.querySelectorAll(t)}catch(r){return n}if("nodelist"===u(t)||u.Array(t))for(var i=0,o=n.length=t.length;o>i;i++){var s=t[i];n[i]=u.DomElement(s)?s:d.elements(s)}else(u.DomElement(t)||t===document||t===e)&&(n=[t]);return n},d.scrollTop=function(t){return t&&"number"==typeof t.scrollTop?t.scrollTop:e.pageYOffset||0},d.scrollLeft=function(t){return t&&"number"==typeof t.scrollLeft?t.scrollLeft:e.pageXOffset||0},d.width=function(e,t,n){return o("width",e,t,n)},d.height=function(e,t,n){return o("height",e,t,n)},d.offset=function(e,t){var n={top:0,left:0};if(e&&e.getBoundingClientRect){var r=e.getBoundingClientRect();n.top=r.top,n.left=r.left,t||(n.top+=d.scrollTop(),n.left+=d.scrollLeft())}return n},n.addClass=function(e,t){t&&(e.classList?e.classList.add(t):e.className+=" "+t)},n.removeClass=function(e,t){t&&(e.classList?e.classList.remove(t):e.className=e.className.replace(RegExp("(^|\\b)"+t.split(" ").join("|")+"(\\b|$)","gi")," "))},n.css=function(e,t){if(u.String(t))return i(e)[s(t)];if(u.Array(t)){var n={},r=i(e);return t.forEach(function(e){n[e]=r[s(e)]}),n}for(var o in t){var a=t[o];a==parseFloat(a)&&(a+="px"),e.style[s(o)]=a}},n}(window||{});return e}); \ No newline at end of file diff --git a/lib/in-view.min.js b/lib/in-view.min.js new file mode 100644 index 00000000..d5616325 --- /dev/null +++ b/lib/in-view.min.js @@ -0,0 +1,6 @@ +/*! + * in-view 0.6.1 - Get notified when a DOM element enters or exits the viewport. + * Copyright (c) 2016 Cam Wiegert - https://camwiegert.github.io/in-view + * License: MIT + */ +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.inView=e():t.inView=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}var i=n(2),o=r(i);t.exports=o["default"]},function(t,e){function n(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}t.exports=n},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(9),o=r(i),u=n(3),f=r(u),s=n(4),c=function(){if("undefined"!=typeof window){var t=100,e=["scroll","resize","load"],n={history:[]},r={offset:{},threshold:0,test:s.inViewport},i=(0,o["default"])(function(){n.history.forEach(function(t){n[t].check()})},t);e.forEach(function(t){return addEventListener(t,i)}),window.MutationObserver&&addEventListener("DOMContentLoaded",function(){new MutationObserver(i).observe(document.body,{attributes:!0,childList:!0,subtree:!0})});var u=function(t){if("string"==typeof t){var e=[].slice.call(document.querySelectorAll(t));return n.history.indexOf(t)>-1?n[t].elements=e:(n[t]=(0,f["default"])(e,r),n.history.push(t)),n[t]}};return u.offset=function(t){if(void 0===t)return r.offset;var e=function(t){return"number"==typeof t};return["top","right","bottom","left"].forEach(e(t)?function(e){return r.offset[e]=t}:function(n){return e(t[n])?r.offset[n]=t[n]:null}),r.offset},u.threshold=function(t){return"number"==typeof t&&t>=0&&t<=1?r.threshold=t:r.threshold},u.test=function(t){return"function"==typeof t?r.test=t:r.test},u.is=function(t){return r.test(t,r)},u.offset(0),u}};e["default"]=c()},function(t,e){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t,e){for(var n=0;n-1,o=n&&!i,u=!n&&i;o&&(t.current.push(e),t.emit("enter",e)),u&&(t.current.splice(r,1),t.emit("exit",e))}),this}},{key:"on",value:function(t,e){return this.handlers[t].push(e),this}},{key:"once",value:function(t,e){return this.singles[t].unshift(e),this}},{key:"emit",value:function(t,e){for(;this.singles[t].length;)this.singles[t].pop()(e);for(var n=this.handlers[t].length;--n>-1;)this.handlers[t][n](e);return this}}]),t}();e["default"]=function(t,e){return new i(t,e)}},function(t,e){"use strict";function n(t,e){var n=t.getBoundingClientRect(),r=n.top,i=n.right,o=n.bottom,u=n.left,f=n.width,s=n.height,c={t:o,r:window.innerWidth-u,b:window.innerHeight-r,l:i},a={x:e.threshold*f,y:e.threshold*s};return c.t>e.offset.top+a.y&&c.r>e.offset.right+a.x&&c.b>e.offset.bottom+a.y&&c.l>e.offset.left+a.x}Object.defineProperty(e,"__esModule",{value:!0}),e.inViewport=n},function(t,e){(function(e){var n="object"==typeof e&&e&&e.Object===Object&&e;t.exports=n}).call(e,function(){return this}())},function(t,e,n){var r=n(5),i="object"==typeof self&&self&&self.Object===Object&&self,o=r||i||Function("return this")();t.exports=o},function(t,e,n){function r(t,e,n){function r(e){var n=x,r=m;return x=m=void 0,E=e,w=t.apply(r,n)}function a(t){return E=t,j=setTimeout(h,e),M?r(t):w}function l(t){var n=t-O,r=t-E,i=e-n;return _?c(i,g-r):i}function d(t){var n=t-O,r=t-E;return void 0===O||n>=e||n<0||_&&r>=g}function h(){var t=o();return d(t)?p(t):void(j=setTimeout(h,l(t)))}function p(t){return j=void 0,T&&x?r(t):(x=m=void 0,w)}function v(){void 0!==j&&clearTimeout(j),E=0,x=O=m=j=void 0}function y(){return void 0===j?w:p(o())}function b(){var t=o(),n=d(t);if(x=arguments,m=this,O=t,n){if(void 0===j)return a(O);if(_)return j=setTimeout(h,e),r(O)}return void 0===j&&(j=setTimeout(h,e)),w}var x,m,g,w,j,O,E=0,M=!1,_=!1,T=!0;if("function"!=typeof t)throw new TypeError(f);return e=u(e)||0,i(n)&&(M=!!n.leading,_="maxWait"in n,g=_?s(u(n.maxWait)||0,e):g,T="trailing"in n?!!n.trailing:T),b.cancel=v,b.flush=y,b}var i=n(1),o=n(8),u=n(10),f="Expected a function",s=Math.max,c=Math.min;t.exports=r},function(t,e,n){var r=n(6),i=function(){return r.Date.now()};t.exports=i},function(t,e,n){function r(t,e,n){var r=!0,f=!0;if("function"!=typeof t)throw new TypeError(u);return o(n)&&(r="leading"in n?!!n.leading:r,f="trailing"in n?!!n.trailing:f),i(t,e,{leading:r,maxWait:e,trailing:f})}var i=n(7),o=n(1),u="Expected a function";t.exports=r},function(t,e){function n(t){return t}t.exports=n}])}); \ No newline at end of file diff --git a/lib/jquery.fancybox.min.css b/lib/jquery.fancybox.min.css new file mode 100644 index 00000000..5d804a59 --- /dev/null +++ b/lib/jquery.fancybox.min.css @@ -0,0 +1 @@ +@charset "UTF-8";body.fancybox-active{overflow:hidden}body.fancybox-iosfix{position:fixed;left:0;right:0}.fancybox-is-hidden{position:absolute;top:-9999px;left:-9999px;visibility:hidden}.fancybox-container{position:fixed;top:0;left:0;width:100%;height:100%;z-index:99992;-webkit-tap-highlight-color:transparent;-webkit-backface-visibility:hidden;backface-visibility:hidden;-webkit-transform:translateZ(0);transform:translateZ(0);font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif}.fancybox-bg,.fancybox-inner,.fancybox-outer,.fancybox-stage{position:absolute;top:0;right:0;bottom:0;left:0}.fancybox-outer{overflow-y:auto;-webkit-overflow-scrolling:touch}.fancybox-bg{background:#1e1e1e;opacity:0;transition-duration:inherit;transition-property:opacity;transition-timing-function:cubic-bezier(.47,0,.74,.71)}.fancybox-is-open .fancybox-bg{opacity:.87;transition-timing-function:cubic-bezier(.22,.61,.36,1)}.fancybox-caption-wrap,.fancybox-infobar,.fancybox-toolbar{position:absolute;direction:ltr;z-index:99997;opacity:0;visibility:hidden;transition:opacity .25s,visibility 0s linear .25s;box-sizing:border-box}.fancybox-show-caption .fancybox-caption-wrap,.fancybox-show-infobar .fancybox-infobar,.fancybox-show-toolbar .fancybox-toolbar{opacity:1;visibility:visible;transition:opacity .25s,visibility 0s}.fancybox-infobar{top:0;left:0;font-size:13px;padding:0 10px;height:44px;min-width:44px;line-height:44px;color:#ccc;text-align:center;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:subpixel-antialiased;mix-blend-mode:exclusion}.fancybox-toolbar{top:0;right:0;margin:0;padding:0}.fancybox-stage{overflow:hidden;direction:ltr;z-index:99994;-webkit-transform:translateZ(0)}.fancybox-is-closing .fancybox-stage{overflow:visible}.fancybox-slide{position:absolute;top:0;left:0;width:100%;height:100%;margin:0;padding:0;overflow:auto;outline:none;white-space:normal;box-sizing:border-box;text-align:center;z-index:99994;-webkit-overflow-scrolling:touch;display:none;-webkit-backface-visibility:hidden;backface-visibility:hidden;transition-property:opacity,-webkit-transform;transition-property:transform,opacity;transition-property:transform,opacity,-webkit-transform}.fancybox-slide:before{content:"";display:inline-block;vertical-align:middle;height:100%;width:0}.fancybox-is-sliding .fancybox-slide,.fancybox-slide--current,.fancybox-slide--next,.fancybox-slide--previous{display:block}.fancybox-slide--image{overflow:visible}.fancybox-slide--image:before{display:none}.fancybox-slide--video .fancybox-content,.fancybox-slide--video iframe{background:#000}.fancybox-slide--map .fancybox-content,.fancybox-slide--map iframe{background:#e5e3df}.fancybox-slide--next{z-index:99995}.fancybox-slide>*{display:inline-block;position:relative;padding:24px;margin:44px 0;border-width:0;vertical-align:middle;text-align:left;background-color:#fff;overflow:auto;box-sizing:border-box}.fancybox-slide>base,.fancybox-slide>link,.fancybox-slide>meta,.fancybox-slide>script,.fancybox-slide>style,.fancybox-slide>title{display:none}.fancybox-slide .fancybox-image-wrap{position:absolute;top:0;left:0;margin:0;padding:0;border:0;z-index:99995;background:transparent;cursor:default;overflow:visible;-webkit-transform-origin:top left;transform-origin:top left;background-size:100% 100%;background-repeat:no-repeat;-webkit-backface-visibility:hidden;backface-visibility:hidden;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;transition-property:opacity,-webkit-transform;transition-property:transform,opacity;transition-property:transform,opacity,-webkit-transform}.fancybox-can-zoomOut .fancybox-image-wrap{cursor:zoom-out}.fancybox-can-zoomIn .fancybox-image-wrap{cursor:zoom-in}.fancybox-can-drag .fancybox-image-wrap{cursor:-webkit-grab;cursor:grab}.fancybox-is-dragging .fancybox-image-wrap{cursor:-webkit-grabbing;cursor:grabbing}.fancybox-image,.fancybox-spaceball{position:absolute;top:0;left:0;width:100%;height:100%;margin:0;padding:0;border:0;max-width:none;max-height:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.fancybox-spaceball{z-index:1}.fancybox-slide--iframe .fancybox-content{padding:0;width:80%;height:80%;max-width:calc(100% - 100px);max-height:calc(100% - 88px);overflow:visible;background:#fff}.fancybox-iframe{display:block;padding:0;border:0;height:100%}.fancybox-error,.fancybox-iframe{margin:0;width:100%;background:#fff}.fancybox-error{padding:40px;max-width:380px;cursor:default}.fancybox-error p{margin:0;padding:0;color:#444;font-size:16px;line-height:20px}.fancybox-button{box-sizing:border-box;display:inline-block;vertical-align:top;width:44px;height:44px;margin:0;padding:10px;border:0;border-radius:0;background:rgba(30,30,30,.6);transition:color .3s ease;cursor:pointer;outline:none}.fancybox-button,.fancybox-button:link,.fancybox-button:visited{color:#ccc}.fancybox-button:focus,.fancybox-button:hover{color:#fff}.fancybox-button[disabled]{color:#ccc;cursor:default;opacity:.6}.fancybox-button svg{display:block;position:relative;overflow:visible;shape-rendering:geometricPrecision}.fancybox-button svg path{fill:currentColor;stroke:currentColor;stroke-linejoin:round;stroke-width:3}.fancybox-button--share svg path{stroke-width:1}.fancybox-button--pause svg path:nth-child(1),.fancybox-button--play svg path:nth-child(2){display:none}.fancybox-button--zoom svg path{fill:transparent}.fancybox-navigation{display:none}.fancybox-show-nav .fancybox-navigation{display:block}.fancybox-navigation button{position:absolute;top:50%;margin:-50px 0 0;z-index:99997;background:transparent;width:60px;height:100px;padding:17px}.fancybox-navigation button:before{content:"";position:absolute;top:30px;right:10px;width:40px;height:40px;background:rgba(30,30,30,.6)}.fancybox-navigation .fancybox-button--arrow_left{left:0}.fancybox-navigation .fancybox-button--arrow_right{right:0}.fancybox-close-small{position:absolute;top:0;right:0;width:40px;height:40px;padding:0;margin:0;border:0;border-radius:0;background:transparent;z-index:10;cursor:pointer}.fancybox-close-small:after{content:"×";position:absolute;top:5px;right:5px;width:30px;height:30px;font:22px/30px Arial,Helvetica Neue,Helvetica,sans-serif;color:#888;font-weight:300;text-align:center;border-radius:50%;border-width:0;background-color:transparent;transition:background-color .25s;box-sizing:border-box;z-index:2}.fancybox-close-small:focus{outline:none}.fancybox-close-small:focus:after{outline:1px dotted #888}.fancybox-close-small:hover:after{color:#555;background:#eee}.fancybox-slide--iframe .fancybox-close-small,.fancybox-slide--image .fancybox-close-small{top:0;right:-40px}.fancybox-slide--iframe .fancybox-close-small:after,.fancybox-slide--image .fancybox-close-small:after{font-size:35px;color:#aaa}.fancybox-slide--iframe .fancybox-close-small:hover:after,.fancybox-slide--image .fancybox-close-small:hover:after{color:#fff;background:transparent}.fancybox-is-scaling .fancybox-close-small,.fancybox-is-zoomable.fancybox-can-drag .fancybox-close-small{display:none}.fancybox-caption-wrap{bottom:0;left:0;right:0;padding:60px 2vw 0;background:linear-gradient(180deg,transparent 0,rgba(0,0,0,.1) 20%,rgba(0,0,0,.2) 40%,rgba(0,0,0,.6) 80%,rgba(0,0,0,.8));pointer-events:none}.fancybox-caption{padding:30px 0;border-top:1px solid hsla(0,0%,100%,.4);font-size:14px;color:#fff;line-height:20px;-webkit-text-size-adjust:none}.fancybox-caption a,.fancybox-caption button,.fancybox-caption select{pointer-events:all;position:relative}.fancybox-caption a{color:#fff;text-decoration:underline}.fancybox-slide>.fancybox-loading{border:6px solid hsla(0,0%,39%,.4);border-top:6px solid hsla(0,0%,100%,.6);border-radius:100%;height:50px;width:50px;-webkit-animation:a .8s infinite linear;animation:a .8s infinite linear;background:transparent;position:absolute;top:50%;left:50%;margin-top:-30px;margin-left:-30px;z-index:99999}@-webkit-keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.fancybox-animated{transition-timing-function:cubic-bezier(0,0,.25,1)}.fancybox-fx-slide.fancybox-slide--previous{-webkit-transform:translate3d(-100%,0,0);transform:translate3d(-100%,0,0);opacity:0}.fancybox-fx-slide.fancybox-slide--next{-webkit-transform:translate3d(100%,0,0);transform:translate3d(100%,0,0);opacity:0}.fancybox-fx-slide.fancybox-slide--current{-webkit-transform:translateZ(0);transform:translateZ(0);opacity:1}.fancybox-fx-fade.fancybox-slide--next,.fancybox-fx-fade.fancybox-slide--previous{opacity:0;transition-timing-function:cubic-bezier(.19,1,.22,1)}.fancybox-fx-fade.fancybox-slide--current{opacity:1}.fancybox-fx-zoom-in-out.fancybox-slide--previous{-webkit-transform:scale3d(1.5,1.5,1.5);transform:scale3d(1.5,1.5,1.5);opacity:0}.fancybox-fx-zoom-in-out.fancybox-slide--next{-webkit-transform:scale3d(.5,.5,.5);transform:scale3d(.5,.5,.5);opacity:0}.fancybox-fx-zoom-in-out.fancybox-slide--current{-webkit-transform:scaleX(1);transform:scaleX(1);opacity:1}.fancybox-fx-rotate.fancybox-slide--previous{-webkit-transform:rotate(-1turn);transform:rotate(-1turn);opacity:0}.fancybox-fx-rotate.fancybox-slide--next{-webkit-transform:rotate(1turn);transform:rotate(1turn);opacity:0}.fancybox-fx-rotate.fancybox-slide--current{-webkit-transform:rotate(0deg);transform:rotate(0deg);opacity:1}.fancybox-fx-circular.fancybox-slide--previous{-webkit-transform:scale3d(0,0,0) translate3d(-100%,0,0);transform:scale3d(0,0,0) translate3d(-100%,0,0);opacity:0}.fancybox-fx-circular.fancybox-slide--next{-webkit-transform:scale3d(0,0,0) translate3d(100%,0,0);transform:scale3d(0,0,0) translate3d(100%,0,0);opacity:0}.fancybox-fx-circular.fancybox-slide--current{-webkit-transform:scaleX(1) translateZ(0);transform:scaleX(1) translateZ(0);opacity:1}.fancybox-fx-tube.fancybox-slide--previous{-webkit-transform:translate3d(-100%,0,0) scale(.1) skew(-10deg);transform:translate3d(-100%,0,0) scale(.1) skew(-10deg)}.fancybox-fx-tube.fancybox-slide--next{-webkit-transform:translate3d(100%,0,0) scale(.1) skew(10deg);transform:translate3d(100%,0,0) scale(.1) skew(10deg)}.fancybox-fx-tube.fancybox-slide--current{-webkit-transform:translateZ(0) scale(1);transform:translateZ(0) scale(1)}.fancybox-share{padding:30px;border-radius:3px;background:#f4f4f4;max-width:90%;text-align:center}.fancybox-share h1{color:#222;margin:0 0 20px;font-size:35px;font-weight:700}.fancybox-share p{margin:0;padding:0}p.fancybox-share__links{margin-right:-10px}.fancybox-share__button{display:inline-block;text-decoration:none;margin:0 10px 10px 0;padding:0 15px;min-width:130px;border:0;border-radius:3px;background:#fff;white-space:nowrap;font-size:14px;font-weight:700;line-height:40px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;color:#fff;transition:all .2s}.fancybox-share__button:hover{text-decoration:none}.fancybox-share__button--fb{background:#3b5998}.fancybox-share__button--fb:hover{background:#344e86}.fancybox-share__button--pt{background:#bd081d}.fancybox-share__button--pt:hover{background:#aa0719}.fancybox-share__button--tw{background:#1da1f2}.fancybox-share__button--tw:hover{background:#0d95e8}.fancybox-share__button svg{position:relative;top:-1px;width:25px;height:25px;margin-right:7px;vertical-align:middle}.fancybox-share__button svg path{fill:#fff}.fancybox-share__input{box-sizing:border-box;width:100%;margin:10px 0 0;padding:10px 15px;background:transparent;color:#5d5b5b;font-size:14px;outline:none;border:0;border-bottom:2px solid #d7d7d7}.fancybox-thumbs{display:none;position:absolute;top:0;bottom:0;right:0;width:212px;margin:0;padding:2px 2px 4px;background:#fff;-webkit-tap-highlight-color:transparent;-webkit-overflow-scrolling:touch;-ms-overflow-style:-ms-autohiding-scrollbar;box-sizing:border-box;z-index:99995}.fancybox-thumbs-x{overflow-y:hidden;overflow-x:auto}.fancybox-show-thumbs .fancybox-thumbs{display:block}.fancybox-show-thumbs .fancybox-inner{right:212px}.fancybox-thumbs>ul{list-style:none;position:absolute;position:relative;width:100%;height:100%;margin:0;padding:0;overflow-x:hidden;overflow-y:auto;font-size:0;white-space:nowrap}.fancybox-thumbs-x>ul{overflow:hidden}.fancybox-thumbs-y>ul::-webkit-scrollbar{width:7px}.fancybox-thumbs-y>ul::-webkit-scrollbar-track{background:#fff;border-radius:10px;box-shadow:inset 0 0 6px rgba(0,0,0,.3)}.fancybox-thumbs-y>ul::-webkit-scrollbar-thumb{background:#2a2a2a;border-radius:10px}.fancybox-thumbs>ul>li{float:left;overflow:hidden;padding:0;margin:2px;width:100px;height:75px;max-width:calc(50% - 4px);max-height:calc(100% - 8px);position:relative;cursor:pointer;outline:none;-webkit-tap-highlight-color:transparent;-webkit-backface-visibility:hidden;backface-visibility:hidden;box-sizing:border-box}li.fancybox-thumbs-loading{background:rgba(0,0,0,.1)}.fancybox-thumbs>ul>li>img{position:absolute;top:0;left:0;max-width:none;max-height:none;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.fancybox-thumbs>ul>li:before{content:"";position:absolute;top:0;right:0;bottom:0;left:0;border:4px solid #4ea7f9;z-index:99991;opacity:0;transition:all .2s cubic-bezier(.25,.46,.45,.94)}.fancybox-thumbs>ul>li.fancybox-thumbs-active:before{opacity:1}@media (max-width:800px){.fancybox-thumbs{width:110px}.fancybox-show-thumbs .fancybox-inner{right:110px}.fancybox-thumbs>ul>li{max-width:calc(100% - 10px)}} \ No newline at end of file diff --git a/lib/jquery.fancybox.min.js b/lib/jquery.fancybox.min.js new file mode 100644 index 00000000..8a0c3e77 --- /dev/null +++ b/lib/jquery.fancybox.min.js @@ -0,0 +1,12 @@ +// ================================================== +// fancyBox v3.2.10 +// +// Licensed GPLv3 for open source use +// or fancyBox Commercial License for commercial use +// +// http://fancyapps.com/fancybox/ +// Copyright 2017 fancyApps +// +// ================================================== +!function(t,e,n,o){"use strict";function i(t){var e=n(t.currentTarget),o=t.data?t.data.options:{},i=e.attr("data-fancybox")||"",a=0,s=[];t.isDefaultPrevented()||(t.preventDefault(),i?(s=o.selector?n(o.selector):t.data?t.data.items:[],s=s.length?s.filter('[data-fancybox="'+i+'"]'):n('[data-fancybox="'+i+'"]'),a=s.index(e),a<0&&(a=0)):s=[e],n.fancybox.open(s,o,a))}if(n){if(n.fn.fancybox)return void("console"in t&&console.log("fancyBox already initialized"));var a={loop:!1,margin:[44,0],gutter:50,keyboard:!0,arrows:!0,infobar:!0,toolbar:!0,buttons:["slideShow","fullScreen","thumbs","share","close"],idleTime:3,smallBtn:"auto",protect:!1,modal:!1,image:{preload:"auto"},ajax:{settings:{data:{fancybox:!0}}},iframe:{tpl:'',preload:!0,css:{},attr:{scrolling:"auto"}},defaultType:"image",animationEffect:"zoom",animationDuration:500,zoomOpacity:"auto",transitionEffect:"fade",transitionDuration:366,slideClass:"",baseClass:"",baseTpl:'',spinnerTpl:'
',errorTpl:'

{{ERROR}}

',btnTpl:{download:'',zoom:'',close:'',smallBtn:'',arrowLeft:'',arrowRight:''},parentEl:"body",autoFocus:!1,backFocus:!0,trapFocus:!0,fullScreen:{autoStart:!1},touch:{vertical:!0,momentum:!0},hash:null,media:{},slideShow:{autoStart:!1,speed:4e3},thumbs:{autoStart:!1,hideOnClose:!0,parentEl:".fancybox-container",axis:"y"},wheel:"auto",onInit:n.noop,beforeLoad:n.noop,afterLoad:n.noop,beforeShow:n.noop,afterShow:n.noop,beforeClose:n.noop,afterClose:n.noop,onActivate:n.noop,onDeactivate:n.noop,clickContent:function(t,e){return"image"===t.type&&"zoom"},clickSlide:"close",clickOutside:"close",dblclickContent:!1,dblclickSlide:!1,dblclickOutside:!1,mobile:{idleTime:!1,margin:0,clickContent:function(t,e){return"image"===t.type&&"toggleControls"},clickSlide:function(t,e){return"image"===t.type?"toggleControls":"close"},dblclickContent:function(t,e){return"image"===t.type&&"zoom"},dblclickSlide:function(t,e){return"image"===t.type&&"zoom"}},lang:"en",i18n:{en:{CLOSE:"Close",NEXT:"Next",PREV:"Previous",ERROR:"The requested content cannot be loaded.
Please try again later.",PLAY_START:"Start slideshow",PLAY_STOP:"Pause slideshow",FULL_SCREEN:"Full screen",THUMBS:"Thumbnails",DOWNLOAD:"Download",SHARE:"Share",ZOOM:"Zoom"},de:{CLOSE:"Schliessen",NEXT:"Weiter",PREV:"Zurück",ERROR:"Die angeforderten Daten konnten nicht geladen werden.
Bitte versuchen Sie es später nochmal.",PLAY_START:"Diaschau starten",PLAY_STOP:"Diaschau beenden",FULL_SCREEN:"Vollbild",THUMBS:"Vorschaubilder",DOWNLOAD:"Herunterladen",SHARE:"Teilen",ZOOM:"Maßstab"}}},s=n(t),r=n(e),c=0,l=function(t){return t&&t.hasOwnProperty&&t instanceof n},u=function(){return t.requestAnimationFrame||t.webkitRequestAnimationFrame||t.mozRequestAnimationFrame||t.oRequestAnimationFrame||function(e){return t.setTimeout(e,1e3/60)}}(),d=function(){var t,n=e.createElement("fakeelement"),i={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(t in i)if(n.style[t]!==o)return i[t];return"transitionend"}(),f=function(t){return t&&t.length&&t[0].offsetHeight},p=function(t,o,i){var a=this;a.opts=n.extend(!0,{index:i},n.fancybox.defaults,o||{}),n.fancybox.isMobile&&(a.opts=n.extend(!0,{},a.opts,a.opts.mobile)),o&&n.isArray(o.buttons)&&(a.opts.buttons=o.buttons),a.id=a.opts.id||++c,a.group=[],a.currIndex=parseInt(a.opts.index,10)||0,a.prevIndex=null,a.prevPos=null,a.currPos=0,a.firstRun=null,a.createGroup(t),a.group.length&&(a.$lastFocus=n(e.activeElement).blur(),a.slides={},a.init())};n.extend(p.prototype,{init:function(){var i,a,s,c=this,l=c.group[c.currIndex],u=l.opts,d=n.fancybox.scrollbarWidth;c.scrollTop=r.scrollTop(),c.scrollLeft=r.scrollLeft(),n.fancybox.getInstance()||(n("body").addClass("fancybox-active"),/iPad|iPhone|iPod/.test(navigator.userAgent)&&!t.MSStream?"image"!==l.type&&n("body").css("top",n("body").scrollTop()*-1).addClass("fancybox-iosfix"):!n.fancybox.isMobile&&e.body.scrollHeight>t.innerHeight&&(d===o&&(i=n('
').appendTo("body"),d=n.fancybox.scrollbarWidth=i[0].offsetWidth-i[0].clientWidth,i.remove()),n("head").append('"),n("body").addClass("compensate-for-scrollbar"))),s="",n.each(u.buttons,function(t,e){s+=u.btnTpl[e]||""}),a=n(c.translate(c,u.baseTpl.replace("{{buttons}}",s).replace("{{arrows}}",u.btnTpl.arrowLeft+u.btnTpl.arrowRight))).attr("id","fancybox-container-"+c.id).addClass("fancybox-is-hidden").addClass(u.baseClass).data("FancyBox",c).appendTo(u.parentEl),c.$refs={container:a},["bg","inner","infobar","toolbar","stage","caption","navigation"].forEach(function(t){c.$refs[t]=a.find(".fancybox-"+t)}),c.trigger("onInit"),c.activate(),c.jumpTo(c.currIndex)},translate:function(t,e){var n=t.opts.i18n[t.opts.lang];return e.replace(/\{\{(\w+)\}\}/g,function(t,e){var i=n[e];return i===o?t:i})},createGroup:function(t){var e=this,i=n.makeArray(t);n.each(i,function(t,i){var a,s,r,c,l,u={},d={};n.isPlainObject(i)?(u=i,d=i.opts||i):"object"===n.type(i)&&n(i).length?(a=n(i),d=a.data(),d=n.extend({},d,d.options||{}),d.$orig=a,u.src=d.src||a.attr("href"),u.type||u.src||(u.type="inline",u.src=i)):u={type:"html",src:i+""},u.opts=n.extend(!0,{},e.opts,d),n.isArray(d.buttons)&&(u.opts.buttons=d.buttons),s=u.type||u.opts.type,c=u.src||"",!s&&c&&(c.match(/(^data:image\/[a-z0-9+\/=]*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg|ico)((\?|#).*)?$)/i)?s="image":c.match(/\.(pdf)((\?|#).*)?$/i)?s="pdf":(r=c.match(/\.(mp4|mov|ogv)((\?|#).*)?$/i))?(s="video",u.opts.videoFormat||(u.opts.videoFormat="video/"+("ogv"===r[1]?"ogg":r[1]))):"#"===c.charAt(0)&&(s="inline")),s?u.type=s:e.trigger("objectNeedsType",u),u.index=e.group.length,u.opts.$orig&&!u.opts.$orig.length&&delete u.opts.$orig,!u.opts.$thumb&&u.opts.$orig&&(u.opts.$thumb=u.opts.$orig.find("img:first")),u.opts.$thumb&&!u.opts.$thumb.length&&delete u.opts.$thumb,"function"===n.type(u.opts.caption)&&(u.opts.caption=u.opts.caption.apply(i,[e,u])),"function"===n.type(e.opts.caption)&&(u.opts.caption=e.opts.caption.apply(i,[e,u])),u.opts.caption instanceof n||(u.opts.caption=u.opts.caption===o?"":u.opts.caption+""),"ajax"===s&&(l=c.split(/\s+/,2),l.length>1&&(u.src=l.shift(),u.opts.filter=l.shift())),"auto"==u.opts.smallBtn&&(n.inArray(s,["html","inline","ajax"])>-1?(u.opts.toolbar=!1,u.opts.smallBtn=!0):u.opts.smallBtn=!1),"pdf"===s&&(u.type="iframe",u.opts.iframe.preload=!1),u.opts.modal&&(u.opts=n.extend(!0,u.opts,{infobar:0,toolbar:0,smallBtn:0,keyboard:0,slideShow:0,fullScreen:0,thumbs:0,touch:0,clickContent:!1,clickSlide:!1,clickOutside:!1,dblclickContent:!1,dblclickSlide:!1,dblclickOutside:!1})),e.group.push(u)})},addEvents:function(){var o=this;o.removeEvents(),o.$refs.container.on("click.fb-close","[data-fancybox-close]",function(t){t.stopPropagation(),t.preventDefault(),o.close(t)}).on("click.fb-prev touchend.fb-prev","[data-fancybox-prev]",function(t){t.stopPropagation(),t.preventDefault(),o.previous()}).on("click.fb-next touchend.fb-next","[data-fancybox-next]",function(t){t.stopPropagation(),t.preventDefault(),o.next()}).on("click.fb","[data-fancybox-zoom]",function(t){o[o.isScaledDown()?"scaleToActual":"scaleToFit"]()}),s.on("orientationchange.fb resize.fb",function(t){t&&t.originalEvent&&"resize"===t.originalEvent.type?u(function(){o.update()}):(o.$refs.stage.hide(),setTimeout(function(){o.$refs.stage.show(),o.update()},600))}),r.on("focusin.fb",function(t){var i=n.fancybox?n.fancybox.getInstance():null;i.isClosing||!i.current||!i.current.opts.trapFocus||n(t.target).hasClass("fancybox-container")||n(t.target).is(e)||i&&"fixed"!==n(t.target).css("position")&&!i.$refs.container.has(t.target).length&&(t.stopPropagation(),i.focus(),s.scrollTop(o.scrollTop).scrollLeft(o.scrollLeft))}),r.on("keydown.fb",function(t){var e=o.current,i=t.keyCode||t.which;if(e&&e.opts.keyboard&&!n(t.target).is("input")&&!n(t.target).is("textarea"))return 8===i||27===i?(t.preventDefault(),void o.close(t)):37===i||38===i?(t.preventDefault(),void o.previous()):39===i||40===i?(t.preventDefault(),void o.next()):void o.trigger("afterKeydown",t,i)}),o.group[o.currIndex].opts.idleTime&&(o.idleSecondsCounter=0,r.on("mousemove.fb-idle mouseleave.fb-idle mousedown.fb-idle touchstart.fb-idle touchmove.fb-idle scroll.fb-idle keydown.fb-idle",function(t){o.idleSecondsCounter=0,o.isIdle&&o.showControls(),o.isIdle=!1}),o.idleInterval=t.setInterval(function(){o.idleSecondsCounter++,o.idleSecondsCounter>=o.group[o.currIndex].opts.idleTime&&!o.isDragging&&(o.isIdle=!0,o.idleSecondsCounter=0,o.hideControls())},1e3))},removeEvents:function(){var e=this;s.off("orientationchange.fb resize.fb"),r.off("focusin.fb keydown.fb .fb-idle"),this.$refs.container.off(".fb-close .fb-prev .fb-next"),e.idleInterval&&(t.clearInterval(e.idleInterval),e.idleInterval=null)},previous:function(t){return this.jumpTo(this.currPos-1,t)},next:function(t){return this.jumpTo(this.currPos+1,t)},jumpTo:function(t,e,i){var a,s,r,c,l,u,d,p=this,h=p.group.length;if(!(p.isDragging||p.isClosing||p.isAnimating&&p.firstRun)){if(t=parseInt(t,10),s=p.current?p.current.opts.loop:p.opts.loop,!s&&(t<0||t>=h))return!1;if(a=p.firstRun=null===p.firstRun,!(h<2&&!a&&p.isDragging)){if(c=p.current,p.prevIndex=p.currIndex,p.prevPos=p.currPos,r=p.createSlide(t),h>1&&((s||r.index>0)&&p.createSlide(t-1),(s||r.indexr.pos?"next":"previous"),c.$slide.removeClass("fancybox-slide--complete fancybox-slide--current fancybox-slide--next fancybox-slide--previous"),c.isComplete=!1,e&&(r.isMoved||r.opts.transitionEffect)&&(r.isMoved?c.$slide.addClass(d):(d="fancybox-animated "+d+" fancybox-fx-"+r.opts.transitionEffect,n.fancybox.animate(c.$slide,d,e,function(){c.$slide.removeClass(d).removeAttr("style")}))))}}},createSlide:function(t){var e,o,i=this;return o=t%i.group.length,o=o<0?i.group.length+o:o,!i.slides[t]&&i.group[o]&&(e=n('
').appendTo(i.$refs.stage),i.slides[t]=n.extend(!0,{},i.group[o],{pos:t,$slide:e,isLoaded:!1}),i.updateSlide(i.slides[t])),i.slides[t]},scaleToActual:function(t,e,i){var a,s,r,c,l,u=this,d=u.current,f=d.$content,p=parseInt(d.$slide.width(),10),h=parseInt(d.$slide.height(),10),g=d.width,b=d.height;"image"!=d.type||d.hasError||!f||u.isAnimating||(n.fancybox.stop(f),u.isAnimating=!0,t=t===o?.5*p:t,e=e===o?.5*h:e,a=n.fancybox.getTranslate(f),c=g/a.width,l=b/a.height,s=.5*p-.5*g,r=.5*h-.5*b,g>p&&(s=a.left*c-(t*c-t),s>0&&(s=0),sh&&(r=a.top*l-(e*l-e),r>0&&(r=0),rt.width||o.height>t.height))},isScaledDown:function(){var t=this,e=t.current,o=e.$content,i=!1;return o&&(i=n.fancybox.getTranslate(o),i=i.width1||Math.abs(n.height()-o.height)>1),o},loadSlide:function(t){var e,o,i,a=this;if(!t.isLoading&&!t.isLoaded){switch(t.isLoading=!0,a.trigger("beforeLoad",t),e=t.type,o=t.$slide,o.off("refresh").trigger("onReset").addClass("fancybox-slide--"+(e||"unknown")).addClass(t.opts.slideClass),e){case"image":a.setImage(t);break;case"iframe":a.setIframe(t);break;case"html":a.setContent(t,t.src||t.content);break;case"inline":n(t.src).length?a.setContent(t,n(t.src)):a.setError(t);break;case"ajax":a.showLoading(t),i=n.ajax(n.extend({},t.opts.ajax.settings,{url:t.src,success:function(e,n){"success"===n&&a.setContent(t,e)},error:function(e,n){e&&"abort"!==n&&a.setError(t)}})),o.one("onReset",function(){i.abort()});break;case"video":a.setContent(t,'");break;default:a.setError(t)}return!0}},setImage:function(e){var o,i,a,s,r=this,c=e.opts.srcset||e.opts.image.srcset;if(c){a=t.devicePixelRatio||1,s=t.innerWidth*a,i=c.split(",").map(function(t){var e={};return t.trim().split(/\s+/).forEach(function(t,n){var o=parseInt(t.substring(0,t.length-1),10);return 0===n?e.url=t:void(o&&(e.value=o,e.postfix=t[t.length-1]))}),e}),i.sort(function(t,e){return t.value-e.value});for(var l=0;l=s||"x"===u.postfix&&u.value>=a){o=u;break}}!o&&i.length&&(o=i[i.length-1]),o&&(e.src=o.url,e.width&&e.height&&"w"==o.postfix&&(e.height=e.width/e.height*o.value,e.width=o.value))}e.$content=n('
').addClass("fancybox-is-hidden").appendTo(e.$slide),e.opts.preload!==!1&&e.opts.width&&e.opts.height&&(e.opts.thumb||e.opts.$thumb)?(e.width=e.opts.width,e.height=e.opts.height,e.$ghost=n("").one("error",function(){n(this).remove(),e.$ghost=null,r.setBigImage(e)}).one("load",function(){r.afterLoad(e),r.setBigImage(e)}).addClass("fancybox-image").appendTo(e.$content).attr("src",e.opts.thumb||e.opts.$thumb.attr("src"))):r.setBigImage(e)},setBigImage:function(t){var e=this,o=n("");t.$image=o.one("error",function(){e.setError(t)}).one("load",function(){clearTimeout(t.timouts),t.timouts=null,e.isClosing||(t.width=t.opts.width||this.naturalWidth,t.height=t.opts.height||this.naturalHeight,t.opts.image.srcset&&o.attr("sizes","100vw").attr("srcset",t.opts.image.srcset),e.hideLoading(t),t.$ghost?t.timouts=setTimeout(function(){t.timouts=null,t.$ghost.hide()},Math.min(300,Math.max(1e3,t.height/1600))):e.afterLoad(t))}).addClass("fancybox-image").attr("src",t.src).appendTo(t.$content),(o[0].complete||"complete"==o[0].readyState)&&o[0].naturalWidth&&o[0].naturalHeight?o.trigger("load"):o[0].error?o.trigger("error"):t.timouts=setTimeout(function(){o[0].complete||t.hasError||e.showLoading(t)},100)},setIframe:function(t){var e,i=this,a=t.opts.iframe,s=t.$slide;t.$content=n('
').css(a.css).appendTo(s),e=n(a.tpl.replace(/\{rnd\}/g,(new Date).getTime())).attr(a.attr).appendTo(t.$content),a.preload?(i.showLoading(t),e.on("load.fb error.fb",function(e){this.isReady=1,t.$slide.trigger("refresh"),i.afterLoad(t)}),s.on("refresh.fb",function(){var n,i,s,r=t.$content,c=a.css.width,l=a.css.height;if(1===e[0].isReady){try{i=e.contents(),s=i.find("body")}catch(t){}s&&s.length&&(c===o&&(n=e[0].contentWindow.document.documentElement.scrollWidth,c=Math.ceil(s.outerWidth(!0)+(r.width()-n)),c+=r.outerWidth()-r.innerWidth()),l===o&&(l=Math.ceil(s.outerHeight(!0)),l+=r.outerHeight()-r.innerHeight()),c&&r.width(c),l&&r.height(l)),r.removeClass("fancybox-is-hidden")}})):this.afterLoad(t),e.attr("src",t.src),t.opts.smallBtn===!0&&t.$content.prepend(i.translate(t,t.opts.btnTpl.smallBtn)),s.one("onReset",function(){try{n(this).find("iframe").hide().attr("src","//about:blank")}catch(t){}n(this).empty(),t.isLoaded=!1})},setContent:function(t,e){var o=this;o.isClosing||(o.hideLoading(t),t.$slide.empty(),l(e)&&e.parent().length?(e.parent(".fancybox-slide--inline").trigger("onReset"),t.$placeholder=n("
").hide().insertAfter(e),e.css("display","inline-block")):t.hasError||("string"===n.type(e)&&(e=n("
").append(n.trim(e)).contents(),3===e[0].nodeType&&(e=n("
").html(e))),t.opts.filter&&(e=n("
").html(e).find(t.opts.filter))),t.$slide.one("onReset",function(){n(this).find("video,audio").trigger("pause"),t.$placeholder&&(t.$placeholder.after(e.hide()).remove(),t.$placeholder=null),t.$smallBtn&&(t.$smallBtn.remove(),t.$smallBtn=null),t.hasError||(n(this).empty(),t.isLoaded=!1)}),t.$content=n(e).appendTo(t.$slide),this.afterLoad(t))},setError:function(t){t.hasError=!0,t.$slide.removeClass("fancybox-slide--"+t.type),this.setContent(t,this.translate(t,t.opts.errorTpl))},showLoading:function(t){var e=this;t=t||e.current,t&&!t.$spinner&&(t.$spinner=n(e.opts.spinnerTpl).appendTo(t.$slide))},hideLoading:function(t){var e=this;t=t||e.current,t&&t.$spinner&&(t.$spinner.remove(),delete t.$spinner)},afterLoad:function(t){var e=this;e.isClosing||(t.isLoading=!1,t.isLoaded=!0,e.trigger("afterLoad",t),e.hideLoading(t),t.opts.smallBtn&&!t.$smallBtn&&(t.$smallBtn=n(e.translate(t,t.opts.btnTpl.smallBtn)).appendTo(t.$content.filter("div,form").first())),t.opts.protect&&t.$content&&!t.hasError&&(t.$content.on("contextmenu.fb",function(t){return 2==t.button&&t.preventDefault(),!0}),"image"===t.type&&n('
').appendTo(t.$content)),e.revealContent(t))},revealContent:function(t){var e,i,a,s,r,c=this,l=t.$slide,u=!1;return e=t.opts[c.firstRun?"animationEffect":"transitionEffect"],a=t.opts[c.firstRun?"animationDuration":"transitionDuration"],a=parseInt(t.forcedDuration===o?a:t.forcedDuration,10),!t.isMoved&&t.pos===c.currPos&&a||(e=!1),"zoom"!==e||t.pos===c.currPos&&a&&"image"===t.type&&!t.hasError&&(u=c.getThumbPos(t))||(e="fade"),"zoom"===e?(r=c.getFitPos(t),r.scaleX=r.width/u.width,r.scaleY=r.height/u.height,delete r.width,delete r.height,s=t.opts.zoomOpacity,"auto"==s&&(s=Math.abs(t.width/t.height-u.width/u.height)>.1),s&&(u.opacity=.1,r.opacity=1),n.fancybox.setTranslate(t.$content.removeClass("fancybox-is-hidden"),u),f(t.$content),void n.fancybox.animate(t.$content,r,a,function(){c.complete()})):(c.updateSlide(t),e?(n.fancybox.stop(l),i="fancybox-animated fancybox-slide--"+(t.pos>=c.prevPos?"next":"previous")+" fancybox-fx-"+e,l.removeAttr("style").removeClass("fancybox-slide--current fancybox-slide--next fancybox-slide--previous").addClass(i),t.$content.removeClass("fancybox-is-hidden"),f(l),void n.fancybox.animate(l,"fancybox-slide--current",a,function(e){l.removeClass(i).removeAttr("style"),t.pos===c.currPos&&c.complete()},!0)):(f(l),t.$content.removeClass("fancybox-is-hidden"),void(t.pos===c.currPos&&c.complete())))},getThumbPos:function(o){var i,a=this,s=!1,r=function(e){for(var o,i=e[0],a=i.getBoundingClientRect(),s=[];null!==i.parentElement;)"hidden"!==n(i.parentElement).css("overflow")&&"auto"!==n(i.parentElement).css("overflow")||s.push(i.parentElement.getBoundingClientRect()),i=i.parentElement;return o=s.every(function(t){var e=Math.min(a.right,t.right)-Math.max(a.left,t.left),n=Math.min(a.bottom,t.bottom)-Math.max(a.top,t.top);return e>0&&n>0}),o&&a.bottom>0&&a.right>0&&a.left=t.currPos-1&&o.pos<=t.currPos+1?i[o.pos]=o:o&&(n.fancybox.stop(o.$slide),o.$slide.off().remove())}),t.slides=i,t.updateCursor(),t.trigger("afterShow"),o.$slide.find("video,audio").first().trigger("play"),(n(e.activeElement).is("[disabled]")||o.opts.autoFocus&&"image"!=o.type&&"iframe"!==o.type)&&t.focus())},preload:function(t){var e=this,n=e.slides[e.currPos+1],o=e.slides[e.currPos-1];n&&n.type===t&&e.loadSlide(n),o&&o.type===t&&e.loadSlide(o)},focus:function(){var t,e=this.current;this.isClosing||(e&&e.isComplete&&(t=e.$slide.find("input[autofocus]:enabled:visible:first"),t.length||(t=e.$slide.find("button,:input,[tabindex],a").filter(":enabled:visible:first"))),t=t&&t.length?t:this.$refs.container,t.focus())},activate:function(){var t=this;n(".fancybox-container").each(function(){var e=n(this).data("FancyBox");e&&e.id!==t.id&&!e.isClosing&&(e.trigger("onDeactivate"),e.removeEvents(),e.isVisible=!1)}),t.isVisible=!0,(t.current||t.isIdle)&&(t.update(),t.updateControls()),t.trigger("onActivate"),t.addEvents()},close:function(t,e){var o,i,a,s,r,c,l=this,p=l.current,h=function(){l.cleanUp(t)};return!l.isClosing&&(l.isClosing=!0,l.trigger("beforeClose",t)===!1?(l.isClosing=!1,u(function(){l.update()}),!1):(l.removeEvents(),p.timouts&&clearTimeout(p.timouts),a=p.$content,o=p.opts.animationEffect,i=n.isNumeric(e)?e:o?p.opts.animationDuration:0,p.$slide.off(d).removeClass("fancybox-slide--complete fancybox-slide--next fancybox-slide--previous fancybox-animated"),p.$slide.siblings().trigger("onReset").remove(),i&&l.$refs.container.removeClass("fancybox-is-open").addClass("fancybox-is-closing"),l.hideLoading(p),l.hideControls(),l.updateCursor(),"zoom"!==o||t!==!0&&a&&i&&"image"===p.type&&!p.hasError&&(c=l.getThumbPos(p))||(o="fade"),"zoom"===o?(n.fancybox.stop(a),r=n.fancybox.getTranslate(a),r.width=r.width*r.scaleX,r.height=r.height*r.scaleY,s=p.opts.zoomOpacity,"auto"==s&&(s=Math.abs(p.width/p.height-c.width/c.height)>.1),s&&(c.opacity=0),r.scaleX=r.width/c.width,r.scaleY=r.height/c.height,r.width=c.width,r.height=c.height,n.fancybox.setTranslate(p.$content,r),f(p.$content),n.fancybox.animate(p.$content,c,i,h),!0):(o&&i?t===!0?setTimeout(h,i):n.fancybox.animate(p.$slide.removeClass("fancybox-slide--current"),"fancybox-animated fancybox-slide--previous fancybox-fx-"+o,i,h):h(),!0)))},cleanUp:function(t){var o,i,a=this,r=n("body");a.current.$slide.trigger("onReset"),a.$refs.container.empty().remove(),a.trigger("afterClose",t),a.$lastFocus&&a.current.opts.backFocus&&a.$lastFocus.focus(),a.current=null,o=n.fancybox.getInstance(),o?o.activate():(s.scrollTop(a.scrollTop).scrollLeft(a.scrollLeft),r.removeClass("fancybox-active compensate-for-scrollbar"),r.hasClass("fancybox-iosfix")&&(i=parseInt(e.body.style.top,10),r.removeClass("fancybox-iosfix").css("top","").scrollTop(i*-1)),n("#fancybox-style-noscroll").remove())},trigger:function(t,e){var o,i=Array.prototype.slice.call(arguments,1),a=this,s=e&&e.opts?e:a.current;return s?i.unshift(s):s=a,i.unshift(a),n.isFunction(s.opts[t])&&(o=s.opts[t].apply(s,i)),o===!1?o:void("afterClose"!==t&&a.$refs?a.$refs.container.trigger(t+".fb",i):r.trigger(t+".fb",i))},updateControls:function(t){var e=this,n=e.current,o=n.index,i=n.opts.caption,a=e.$refs.container,s=e.$refs.caption;n.$slide.trigger("refresh"),e.$caption=i&&i.length?s.html(i):null,e.isHiddenControls||e.isIdle||e.showControls(),a.find("[data-fancybox-count]").html(e.group.length),a.find("[data-fancybox-index]").html(o+1),a.find("[data-fancybox-prev]").prop("disabled",!n.opts.loop&&o<=0),a.find("[data-fancybox-next]").prop("disabled",!n.opts.loop&&o>=e.group.length-1),"image"===n.type?a.find("[data-fancybox-download]").attr("href",n.opts.image.src||n.src).show():a.find("[data-fancybox-download],[data-fancybox-zoom]").hide()},hideControls:function(){this.isHiddenControls=!0,this.$refs.container.removeClass("fancybox-show-infobar fancybox-show-toolbar fancybox-show-caption fancybox-show-nav")},showControls:function(){var t=this,e=t.current?t.current.opts:t.opts,n=t.$refs.container;t.isHiddenControls=!1,t.idleSecondsCounter=0,n.toggleClass("fancybox-show-toolbar",!(!e.toolbar||!e.buttons)).toggleClass("fancybox-show-infobar",!!(e.infobar&&t.group.length>1)).toggleClass("fancybox-show-nav",!!(e.arrows&&t.group.length>1)).toggleClass("fancybox-is-modal",!!e.modal),t.$caption?n.addClass("fancybox-show-caption "):n.removeClass("fancybox-show-caption")},toggleControls:function(){this.isHiddenControls?this.showControls():this.hideControls()}}),n.fancybox={version:"3.2.10",defaults:a,getInstance:function(t){var e=n('.fancybox-container:not(".fancybox-is-closing"):last').data("FancyBox"),o=Array.prototype.slice.call(arguments,1);return e instanceof p&&("string"===n.type(t)?e[t].apply(e,o):"function"===n.type(t)&&t.apply(e,o),e)},open:function(t,e,n){return new p(t,e,n)},close:function(t){var e=this.getInstance();e&&(e.close(),t===!0&&this.close())},destroy:function(){this.close(!0),r.off("click.fb-start")},isMobile:e.createTouch!==o&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),use3d:function(){var n=e.createElement("div");return t.getComputedStyle&&t.getComputedStyle(n).getPropertyValue("transform")&&!(e.documentMode&&e.documentMode<11)}(),getTranslate:function(t){var e;if(!t||!t.length)return!1;if(e=t.eq(0).css("transform"),e&&e.indexOf("matrix")!==-1?(e=e.split("(")[1],e=e.split(")")[0],e=e.split(",")):e=[],e.length)e=e.length>10?[e[13],e[12],e[0],e[5]]:[e[5],e[4],e[0],e[3]],e=e.map(parseFloat);else{e=[0,0,1,1];var n=/\.*translate\((.*)px,(.*)px\)/i,o=n.exec(t.eq(0).attr("style"));o&&(e[0]=parseFloat(o[2]),e[1]=parseFloat(o[1]))}return{top:e[0],left:e[1],scaleX:e[2],scaleY:e[3],opacity:parseFloat(t.css("opacity")),width:t.width(),height:t.height()}},setTranslate:function(t,e){var n="",i={};if(t&&e)return e.left===o&&e.top===o||(n=(e.left===o?t.position().left:e.left)+"px, "+(e.top===o?t.position().top:e.top)+"px",n=this.use3d?"translate3d("+n+", 0px)":"translate("+n+")"),e.scaleX!==o&&e.scaleY!==o&&(n=(n.length?n+" ":"")+"scale("+e.scaleX+", "+e.scaleY+")"),n.length&&(i.transform=n),e.opacity!==o&&(i.opacity=e.opacity),e.width!==o&&(i.width=e.width),e.height!==o&&(i.height=e.height),t.css(i)},animate:function(t,e,i,a,s){n.isFunction(i)&&(a=i,i=null),n.isPlainObject(e)||t.removeAttr("style"),t.on(d,function(i){(!i||!i.originalEvent||t.is(i.originalEvent.target)&&"z-index"!=i.originalEvent.propertyName)&&(n.fancybox.stop(t),n.isPlainObject(e)?(e.scaleX!==o&&e.scaleY!==o&&(t.css("transition-duration",""),e.width=Math.round(t.width()*e.scaleX),e.height=Math.round(t.height()*e.scaleY),e.scaleX=1,e.scaleY=1,n.fancybox.setTranslate(t,e)),s===!1&&t.removeAttr("style")):s!==!0&&t.removeClass(e),n.isFunction(a)&&a(i))}),n.isNumeric(i)&&t.css("transition-duration",i+"ms"),n.isPlainObject(e)?n.fancybox.setTranslate(t,e):t.addClass(e),e.scaleX&&t.hasClass("fancybox-image-wrap")&&t.parent().addClass("fancybox-is-scaling"),t.data("timer",setTimeout(function(){t.trigger("transitionend")},i+16))},stop:function(t){clearTimeout(t.data("timer")),t.off("transitionend").css("transition-duration",""),t.hasClass("fancybox-image-wrap")&&t.parent().removeClass("fancybox-is-scaling")}},n.fn.fancybox=function(t){var e;return t=t||{},e=t.selector||!1,e?n("body").off("click.fb-start",e).on("click.fb-start",e,{options:t},i):this.off("click.fb-start").on("click.fb-start",{items:this,options:t},i),this},r.on("click.fb-start","[data-fancybox]",i)}}(window,document,window.jQuery||jQuery),function(t){"use strict";var e=function(e,n,o){if(e)return o=o||"","object"===t.type(o)&&(o=t.param(o,!0)),t.each(n,function(t,n){e=e.replace("$"+t,n||"")}),o.length&&(e+=(e.indexOf("?")>0?"&":"?")+o),e},n={youtube:{matcher:/(youtube\.com|youtu\.be|youtube\-nocookie\.com)\/(watch\?(.*&)?v=|v\/|u\/|embed\/?)?(videoseries\?list=(.*)|[\w-]{11}|\?listType=(.*)&list=(.*))(.*)/i,params:{autoplay:1,autohide:1,fs:1,rel:0,hd:1,wmode:"transparent",enablejsapi:1,html5:1},paramPlace:8,type:"iframe",url:"//www.youtube.com/embed/$4",thumb:"//img.youtube.com/vi/$4/hqdefault.jpg" +},vimeo:{matcher:/^.+vimeo.com\/(.*\/)?([\d]+)(.*)?/,params:{autoplay:1,hd:1,show_title:1,show_byline:1,show_portrait:0,fullscreen:1,api:1},paramPlace:3,type:"iframe",url:"//player.vimeo.com/video/$2"},metacafe:{matcher:/metacafe.com\/watch\/(\d+)\/(.*)?/,type:"iframe",url:"//www.metacafe.com/embed/$1/?ap=1"},dailymotion:{matcher:/dailymotion.com\/video\/(.*)\/?(.*)/,params:{additionalInfos:0,autoStart:1},type:"iframe",url:"//www.dailymotion.com/embed/video/$1"},vine:{matcher:/vine.co\/v\/([a-zA-Z0-9\?\=\-]+)/,type:"iframe",url:"//vine.co/v/$1/embed/simple"},instagram:{matcher:/(instagr\.am|instagram\.com)\/p\/([a-zA-Z0-9_\-]+)\/?/i,type:"image",url:"//$1/p/$2/media/?size=l"},gmap_place:{matcher:/(maps\.)?google\.([a-z]{2,3}(\.[a-z]{2})?)\/(((maps\/(place\/(.*)\/)?\@(.*),(\d+.?\d+?)z))|(\?ll=))(.*)?/i,type:"iframe",url:function(t){return"//maps.google."+t[2]+"/?ll="+(t[9]?t[9]+"&z="+Math.floor(t[10])+(t[12]?t[12].replace(/^\//,"&"):""):t[12])+"&output="+(t[12]&&t[12].indexOf("layer=c")>0?"svembed":"embed")}},gmap_search:{matcher:/(maps\.)?google\.([a-z]{2,3}(\.[a-z]{2})?)\/(maps\/search\/)(.*)/i,type:"iframe",url:function(t){return"//maps.google."+t[2]+"/maps?q="+t[5].replace("query=","q=").replace("api=1","")+"&output=embed"}}};t(document).on("objectNeedsType.fb",function(o,i,a){var s,r,c,l,u,d,f,p=a.src||"",h=!1;s=t.extend(!0,{},n,a.opts.media),t.each(s,function(n,o){if(c=p.match(o.matcher)){if(h=o.type,d={},o.paramPlace&&c[o.paramPlace]){u=c[o.paramPlace],"?"==u[0]&&(u=u.substring(1)),u=u.split("&");for(var i=0;ie.clientHeight,a=("scroll"===o||"auto"===o)&&e.scrollWidth>e.clientWidth;return i||a},l=function(t){for(var e=!1;;){if(e=c(t.get(0)))break;if(t=t.parent(),!t.length||t.hasClass("fancybox-stage")||t.is("body"))break}return e},u=function(t){var e=this;e.instance=t,e.$bg=t.$refs.bg,e.$stage=t.$refs.stage,e.$container=t.$refs.container,e.destroy(),e.$container.on("touchstart.fb.touch mousedown.fb.touch",n.proxy(e,"ontouchstart"))};u.prototype.destroy=function(){this.$container.off(".fb.touch")},u.prototype.ontouchstart=function(o){var i=this,c=n(o.target),u=i.instance,d=u.current,f=d.$content,p="touchstart"==o.type;if(p&&i.$container.off("mousedown.fb.touch"),(!o.originalEvent||2!=o.originalEvent.button)&&c.length&&!r(c)&&!r(c.parent())&&(c.is("img")||!(o.originalEvent.clientX>c[0].clientWidth+c.offset().left))){if(!d||i.instance.isAnimating||i.instance.isClosing)return o.stopPropagation(),void o.preventDefault();if(i.realPoints=i.startPoints=a(o),i.startPoints){if(o.stopPropagation(),i.startEvent=o,i.canTap=!0,i.$target=c,i.$content=f,i.opts=d.opts.touch,i.isPanning=!1,i.isSwiping=!1,i.isZooming=!1,i.isScrolling=!1,i.sliderStartPos=i.sliderLastPos||{top:0,left:0},i.contentStartPos=n.fancybox.getTranslate(i.$content),i.contentLastPos=null,i.startTime=(new Date).getTime(),i.distanceX=i.distanceY=i.distance=0,i.canvasWidth=Math.round(d.$slide[0].clientWidth),i.canvasHeight=Math.round(d.$slide[0].clientHeight),n(e).off(".fb.touch").on(p?"touchend.fb.touch touchcancel.fb.touch":"mouseup.fb.touch mouseleave.fb.touch",n.proxy(i,"ontouchend")).on(p?"touchmove.fb.touch":"mousemove.fb.touch",n.proxy(i,"ontouchmove")),n.fancybox.isMobile&&e.addEventListener("scroll",i.onscroll,!0),!i.opts&&!u.canPan()||!c.is(i.$stage)&&!i.$stage.find(c).length)return void(c.is("img")&&o.preventDefault());n.fancybox.isMobile&&(l(c)||l(c.parent()))||o.preventDefault(),1===i.startPoints.length&&("image"===d.type&&(i.contentStartPos.width>i.canvasWidth+1||i.contentStartPos.height>i.canvasHeight+1)?(n.fancybox.stop(i.$content),i.$content.css("transition-duration",""),i.isPanning=!0):i.isSwiping=!0,i.$container.addClass("fancybox-controls--isGrabbing")),2!==i.startPoints.length||u.isAnimating||d.hasError||"image"!==d.type||!d.isLoaded&&!d.$ghost||(i.canTap=!1,i.isSwiping=!1,i.isPanning=!1,i.isZooming=!0,n.fancybox.stop(i.$content),i.$content.css("transition-duration",""),i.centerPointStartX=.5*(i.startPoints[0].x+i.startPoints[1].x)-n(t).scrollLeft(),i.centerPointStartY=.5*(i.startPoints[0].y+i.startPoints[1].y)-n(t).scrollTop(),i.percentageOfImageAtPinchPointX=(i.centerPointStartX-i.contentStartPos.left)/i.contentStartPos.width,i.percentageOfImageAtPinchPointY=(i.centerPointStartY-i.contentStartPos.top)/i.contentStartPos.height,i.startDistanceBetweenFingers=s(i.startPoints[0],i.startPoints[1]))}}},u.prototype.onscroll=function(t){self.isScrolling=!0},u.prototype.ontouchmove=function(t){var e=this,o=n(t.target);return e.isScrolling||!o.is(e.$stage)&&!e.$stage.find(o).length?void(e.canTap=!1):(e.newPoints=a(t),void((e.opts||e.instance.canPan())&&e.newPoints&&e.newPoints.length&&(e.isSwiping&&e.isSwiping===!0||t.preventDefault(),e.distanceX=s(e.newPoints[0],e.startPoints[0],"x"),e.distanceY=s(e.newPoints[0],e.startPoints[0],"y"),e.distance=s(e.newPoints[0],e.startPoints[0]),e.distance>0&&(e.isSwiping?e.onSwipe(t):e.isPanning?e.onPan():e.isZooming&&e.onZoom()))))},u.prototype.onSwipe=function(e){var a,s=this,r=s.isSwiping,c=s.sliderStartPos.left||0;if(r!==!0)"x"==r&&(s.distanceX>0&&(s.instance.group.length<2||0===s.instance.current.index&&!s.instance.current.opts.loop)?c+=Math.pow(s.distanceX,.8):s.distanceX<0&&(s.instance.group.length<2||s.instance.current.index===s.instance.group.length-1&&!s.instance.current.opts.loop)?c-=Math.pow(-s.distanceX,.8):c+=s.distanceX),s.sliderLastPos={top:"x"==r?0:s.sliderStartPos.top+s.distanceY,left:c},s.requestId&&(i(s.requestId),s.requestId=null),s.requestId=o(function(){s.sliderLastPos&&(n.each(s.instance.slides,function(t,e){var o=e.pos-s.instance.currPos;n.fancybox.setTranslate(e.$slide,{top:s.sliderLastPos.top,left:s.sliderLastPos.left+o*s.canvasWidth+o*e.opts.gutter})}),s.$container.addClass("fancybox-is-sliding"))});else if(Math.abs(s.distance)>10){if(s.canTap=!1,s.instance.group.length<2&&s.opts.vertical?s.isSwiping="y":s.instance.isDragging||s.opts.vertical===!1||"auto"===s.opts.vertical&&n(t).width()>800?s.isSwiping="x":(a=Math.abs(180*Math.atan2(s.distanceY,s.distanceX)/Math.PI),s.isSwiping=a>45&&a<135?"y":"x"),s.canTap=!1,"y"===s.isSwiping&&n.fancybox.isMobile&&(l(s.$target)||l(s.$target.parent())))return void(s.isScrolling=!0);s.instance.isDragging=s.isSwiping,s.startPoints=s.newPoints,n.each(s.instance.slides,function(t,e){n.fancybox.stop(e.$slide),e.$slide.css("transition-duration",""),e.inTransition=!1,e.pos===s.instance.current.pos&&(s.sliderStartPos.left=n.fancybox.getTranslate(e.$slide).left)}),s.instance.SlideShow&&s.instance.SlideShow.isActive&&s.instance.SlideShow.stop()}},u.prototype.onPan=function(){var t=this;return s(t.newPoints[0],t.realPoints[0])<(n.fancybox.isMobile?10:5)?void(t.startPoints=t.newPoints):(t.canTap=!1,t.contentLastPos=t.limitMovement(),t.requestId&&(i(t.requestId),t.requestId=null),void(t.requestId=o(function(){n.fancybox.setTranslate(t.$content,t.contentLastPos)})))},u.prototype.limitMovement=function(){var t,e,n,o,i,a,s=this,r=s.canvasWidth,c=s.canvasHeight,l=s.distanceX,u=s.distanceY,d=s.contentStartPos,f=d.left,p=d.top,h=d.width,g=d.height;return i=h>r?f+l:f,a=p+u,t=Math.max(0,.5*r-.5*h),e=Math.max(0,.5*c-.5*g),n=Math.min(r-h,.5*r-.5*h),o=Math.min(c-g,.5*c-.5*g),h>r&&(l>0&&i>t&&(i=t-1+Math.pow(-t+f+l,.8)||0),l<0&&ic&&(u>0&&a>e&&(a=e-1+Math.pow(-e+p+u,.8)||0),u<0&&aa?(t=t>0?0:t,t=ts?(e=e>0?0:e,e=e50?(n.fancybox.animate(o.instance.current.$slide,{top:o.sliderStartPos.top+o.distanceY+150*o.velocityY,opacity:0},150),i=o.instance.close(!0,300)):"x"==t&&o.distanceX>50&&a>1?i=o.instance.previous(o.speedX):"x"==t&&o.distanceX<-50&&a>1&&(i=o.instance.next(o.speedX)),i!==!1||"x"!=t&&"y"!=t||(e||a<2?o.instance.centerSlide(o.instance.current,150):o.instance.jumpTo(o.instance.current.index)),o.$container.removeClass("fancybox-is-sliding")},u.prototype.endPanning=function(){var t,e,o,i=this;i.contentLastPos&&(i.opts.momentum===!1?(t=i.contentLastPos.left,e=i.contentLastPos.top):(t=i.contentLastPos.left+i.velocityX*i.speed,e=i.contentLastPos.top+i.velocityY*i.speed),o=i.limitPosition(t,e,i.contentStartPos.width,i.contentStartPos.height),o.width=i.contentStartPos.width,o.height=i.contentStartPos.height,n.fancybox.animate(i.$content,o,330))},u.prototype.endZooming=function(){var t,e,o,i,a=this,s=a.instance.current,r=a.newWidth,c=a.newHeight;a.contentLastPos&&(t=a.contentLastPos.left,e=a.contentLastPos.top,i={top:e,left:t,width:r,height:c,scaleX:1,scaleY:1},n.fancybox.setTranslate(a.$content,i),rs.width||c>s.height?a.instance.scaleToActual(a.centerPointStartX,a.centerPointStartY,150):(o=a.limitPosition(t,e,r,c),n.fancybox.setTranslate(a.content,n.fancybox.getTranslate(a.$content)),n.fancybox.animate(a.$content,o,150)))},u.prototype.onTap=function(t){var e,o=this,i=n(t.target),s=o.instance,r=s.current,c=t&&a(t)||o.startPoints,l=c[0]?c[0].x-o.$stage.offset().left:0,u=c[0]?c[0].y-o.$stage.offset().top:0,d=function(e){var i=r.opts[e];if(n.isFunction(i)&&(i=i.apply(s,[r,t])),i)switch(i){case"close":s.close(o.startEvent);break;case"toggleControls":s.toggleControls(!0);break;case"next":s.next();break;case"nextOrClose":s.group.length>1?s.next():s.close(o.startEvent);break;case"zoom":"image"==r.type&&(r.isLoaded||r.$ghost)&&(s.canPan()?s.scaleToFit():s.isScaledDown()?s.scaleToActual(l,u):s.group.length<2&&s.close(o.startEvent))}};if((!t.originalEvent||2!=t.originalEvent.button)&&(i.is("img")||!(l>i[0].clientWidth+i.offset().left))){if(i.is(".fancybox-bg,.fancybox-inner,.fancybox-outer,.fancybox-container"))e="Outside";else if(i.is(".fancybox-slide"))e="Slide";else{if(!s.current.$content||!s.current.$content.find(i).addBack().filter(i).length)return;e="Content"}if(o.tapped){if(clearTimeout(o.tapped),o.tapped=null,Math.abs(l-o.tapX)>50||Math.abs(u-o.tapY)>50)return this;d("dblclick"+e)}else o.tapX=l,o.tapY=u,r.opts["dblclick"+e]&&r.opts["dblclick"+e]!==r.opts["click"+e]?o.tapped=setTimeout(function(){o.tapped=null,d("click"+e)},500):d("click"+e);return this}},n(e).on("onActivate.fb",function(t,e){e&&!e.Guestures&&(e.Guestures=new u(e))})}(window,document,window.jQuery||jQuery),function(t,e){"use strict";e.extend(!0,e.fancybox.defaults,{btnTpl:{slideShow:''},slideShow:{autoStart:!1,speed:3e3}});var n=function(t){this.instance=t,this.init()};e.extend(n.prototype,{timer:null,isActive:!1,$button:null,init:function(){var t=this;t.$button=t.instance.$refs.toolbar.find("[data-fancybox-play]").on("click",function(){t.toggle()}),(t.instance.group.length<2||!t.instance.group[t.instance.currIndex].opts.slideShow)&&t.$button.hide()},set:function(t){var e=this;e.instance&&e.instance.current&&(t===!0||e.instance.current.opts.loop||e.instance.currIndex'},fullScreen:{autoStart:!1}}),e(t).on({"onInit.fb":function(t,e){var n;e&&e.group[e.currIndex].opts.fullScreen?(n=e.$refs.container,n.on("click.fb-fullscreen","[data-fancybox-fullscreen]",function(t){t.stopPropagation(),t.preventDefault(),o.toggle(n[0])}),e.opts.fullScreen&&e.opts.fullScreen.autoStart===!0&&o.request(n[0]),e.FullScreen=o):e&&e.$refs.toolbar.find("[data-fancybox-fullscreen]").hide()},"afterKeydown.fb":function(t,e,n,o,i){e&&e.FullScreen&&70===i&&(o.preventDefault(),e.FullScreen.toggle(e.$refs.container[0]))},"beforeClose.fb":function(t){t&&t.FullScreen&&o.exit()}}),e(t).on(n.fullscreenchange,function(){var t=o.isFullscreen(),n=e.fancybox.getInstance();n&&(n.current&&"image"===n.current.type&&n.isAnimating&&(n.current.$content.css("transition","none"),n.isAnimating=!1,n.update(!0,!0,0)),n.trigger("onFullscreenChange",t),n.$refs.container.toggleClass("fancybox-is-fullscreen",t))})}(document,window.jQuery||jQuery),function(t,e){"use strict";e.fancybox.defaults=e.extend(!0,{btnTpl:{thumbs:''},thumbs:{autoStart:!1,hideOnClose:!0,parentEl:".fancybox-container",axis:"y"}},e.fancybox.defaults);var n=function(t){this.init(t)};e.extend(n.prototype,{$button:null,$grid:null,$list:null,isVisible:!1,isActive:!1,init:function(t){var e=this;e.instance=t,t.Thumbs=e;var n=t.group[0],o=t.group[1];e.opts=t.group[t.currIndex].opts.thumbs,e.$button=t.$refs.toolbar.find("[data-fancybox-thumbs]"),e.opts&&n&&o&&("image"==n.type||n.opts.thumb||n.opts.$thumb)&&("image"==o.type||o.opts.thumb||o.opts.$thumb)?(e.$button.show().on("click",function(){e.toggle()}),e.isActive=!0):e.$button.hide()},create:function(){var t,n,o=this,i=o.instance,a=o.opts.parentEl;o.$grid=e('
').appendTo(i.$refs.container.find(a).addBack().filter(a)),t="
    ",e.each(i.group,function(e,o){n=o.opts.thumb||(o.opts.$thumb?o.opts.$thumb.attr("src"):null),n||"image"!==o.type||(n=o.src),n&&n.length&&(t+='
  • ')}),t+="
",o.$list=e(t).appendTo(o.$grid).on("click","li",function(){i.jumpTo(e(this).data("index"))}),o.$list.find("img").hide().one("load",function(){var t,n,o,i,a=e(this).parent().removeClass("fancybox-thumbs-loading"),s=a.outerWidth(),r=a.outerHeight();t=this.naturalWidth||this.width,n=this.naturalHeight||this.height,o=t/s,i=n/r,o>=1&&i>=1&&(o>i?(t/=i,n=r):(t=s,n/=o)),e(this).css({width:Math.floor(t),height:Math.floor(n),"margin-top":n>r?Math.floor(.3*r-.3*n):Math.floor(.5*r-.5*n),"margin-left":Math.floor(.5*s-.5*t)}).show()}).each(function(){this.src=e(this).data("src")}),"x"===o.opts.axis&&o.$list.width(parseInt(o.$grid.css("padding-right"))+i.group.length*o.$list.children().eq(0).outerWidth(!0)+"px")},focus:function(t){var e,n,o=this,i=o.$list;o.instance.current&&(e=i.children().removeClass("fancybox-thumbs-active").filter('[data-index="'+o.instance.current.index+'"]').addClass("fancybox-thumbs-active"),n=e.position(),"y"===o.opts.axis&&(n.top<0||n.top>i.height()-e.outerHeight())?i.stop().animate({scrollTop:i.scrollTop()+n.top},t):"x"===o.opts.axis&&(n.lefti.parent().scrollLeft()+(i.parent().width()-e.outerWidth()))&&i.parent().stop().animate({scrollLeft:n.left},t))},update:function(){this.instance.$refs.container.toggleClass("fancybox-show-thumbs",this.isVisible),this.isVisible?(this.$grid||this.create(),this.instance.trigger("onThumbsShow"),this.focus(0)):this.$grid&&this.instance.trigger("onThumbsHide"),this.instance.update()},hide:function(){this.isVisible=!1,this.update()},show:function(){this.isVisible=!0,this.update()},toggle:function(){this.isVisible=!this.isVisible,this.update()}}),e(t).on({"onInit.fb":function(t,e){var o;e&&!e.Thumbs&&(o=new n(e),o.isActive&&o.opts.autoStart===!0&&o.show())},"beforeShow.fb":function(t,e,n,o){var i=e&&e.Thumbs;i&&i.isVisible&&i.focus(o?0:250)},"afterKeydown.fb":function(t,e,n,o,i){var a=e&&e.Thumbs;a&&a.isActive&&71===i&&(o.preventDefault(),a.toggle())},"beforeClose.fb":function(t,e){var n=e&&e.Thumbs;n&&n.isVisible&&n.opts.hideOnClose!==!1&&n.$grid.hide()}})}(document,window.jQuery),function(t,e){"use strict";function n(t){var e={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};return String(t).replace(/[&<>"'`=\/]/g,function(t){return e[t]})}e.extend(!0,e.fancybox.defaults,{btnTpl:{share:''},share:{tpl:''}}),e(t).on("click","[data-fancybox-share]",function(){var t,o,i=e.fancybox.getInstance();i&&(t=i.current.opts.hash===!1?i.current.src:window.location,o=i.current.opts.share.tpl.replace(/\{\{media\}\}/g,"image"===i.current.type?encodeURIComponent(i.current.src):"").replace(/\{\{url\}\}/g,encodeURIComponent(t)).replace(/\{\{url_raw\}\}/g,n(t)).replace(/\{\{descr\}\}/g,i.$caption?encodeURIComponent(i.$caption.text()):""),e.fancybox.open({src:i.translate(i,o),type:"html",opts:{animationEffect:"fade",animationDuration:250,afterLoad:function(t,e){e.$content.find(".fancybox-share__links a").click(function(){return window.open(this.href,"Share","width=550, height=450"),!1})}}}))})}(document,window.jQuery||jQuery),function(t,e,n){"use strict";function o(){var t=e.location.hash.substr(1),n=t.split("-"),o=n.length>1&&/^\+?\d+$/.test(n[n.length-1])?parseInt(n.pop(-1),10)||1:1,i=n.join("-");return o<1&&(o=1),{hash:t,index:o,gallery:i}}function i(t){var e;""!==t.gallery&&(e=n("[data-fancybox='"+n.escapeSelector(t.gallery)+"']").eq(t.index-1),e.length||(e=n("#"+n.escapeSelector(t.gallery))),e.length&&(s=!1,e.trigger("click")))}function a(t){var e;return!!t&&(e=t.current?t.current.opts:t.opts,e.hash||(e.$orig?e.$orig.data("fancybox"):""))}n.escapeSelector||(n.escapeSelector=function(t){var e=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g,n=function(t,e){return e?"\0"===t?"�":t.slice(0,-1)+"\\"+t.charCodeAt(t.length-1).toString(16)+" ":"\\"+t};return(t+"").replace(e,n)});var s=!0,r=null,c=null;n(function(){n.fancybox.defaults.hash!==!1&&(n(t).on({"onInit.fb":function(t,e){var n,i;e.group[e.currIndex].opts.hash!==!1&&(n=o(),i=a(e),i&&n.gallery&&i==n.gallery&&(e.currIndex=n.index-1))},"beforeShow.fb":function(n,o,i){var l;i&&i.opts.hash!==!1&&(l=a(o),l&&""!==l&&(e.location.hash.indexOf(l)<0&&(o.opts.origHash=e.location.hash),r=l+(o.group.length>1?"-"+(i.index+1):""),"replaceState"in e.history?(c&&clearTimeout(c),c=setTimeout(function(){e.history[s?"pushState":"replaceState"]({},t.title,e.location.pathname+e.location.search+"#"+r),c=null,s=!1},300)):e.location.hash=r))},"beforeClose.fb":function(o,i,s){var l,u;c&&clearTimeout(c),s.opts.hash!==!1&&(l=a(i),u=i&&i.opts.origHash?i.opts.origHash:"",l&&""!==l&&("replaceState"in history?e.history.replaceState({},t.title,e.location.pathname+e.location.search+u):(e.location.hash=u,n(e).scrollTop(i.scrollTop).scrollLeft(i.scrollLeft))),r=null)}}),n(e).on("hashchange.fb",function(){var t=o();n.fancybox.getInstance()?!r||r===t.gallery+"-"+t.index||1===t.index&&r==t.gallery||(r=null,n.fancybox.close()):""!==t.gallery&&i(t)}),setTimeout(function(){i(o())},50))})}(document,window,window.jQuery||jQuery),function(t,e){"use strict";var n=(new Date).getTime();e(t).on({"onInit.fb":function(t,e,o){e.$refs.stage.on("mousewheel DOMMouseScroll wheel MozMousePixelScroll",function(t){var o=e.current,i=(new Date).getTime();e.group.length<1||o.opts.wheel===!1||"auto"===o.opts.wheel&&"image"!==o.type||(t.preventDefault(),t.stopPropagation(),o.$slide.hasClass("fancybox-animated")||(t=t.originalEvent||t,i-n<250||(n=i,e[(-t.deltaY||-t.deltaX||t.wheelDelta||-t.detail)<0?"next":"previous"]())))})}})}(document,window.jQuery||jQuery); \ No newline at end of file diff --git a/lib/lodash.min.js b/lib/lodash.min.js new file mode 100644 index 00000000..ca447f4e --- /dev/null +++ b/lib/lodash.min.js @@ -0,0 +1,136 @@ +/** + * @license + * Lodash lodash.com/license | Underscore.js 1.8.3 underscorejs.org/LICENSE + */ +;(function(){function n(n,t){return n.set(t[0],t[1]),n}function t(n,t){return n.add(t),n}function r(n,t,r){switch(r.length){case 0:return n.call(t);case 1:return n.call(t,r[0]);case 2:return n.call(t,r[0],r[1]);case 3:return n.call(t,r[0],r[1],r[2])}return n.apply(t,r)}function e(n,t,r,e){for(var u=-1,i=null==n?0:n.length;++u"']/g,J=RegExp(G.source),Y=RegExp(H.source),Q=/<%-([\s\S]+?)%>/g,X=/<%([\s\S]+?)%>/g,nn=/<%=([\s\S]+?)%>/g,tn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,rn=/^\w*$/,en=/^\./,un=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,on=/[\\^$.*+?()[\]{}|]/g,fn=RegExp(on.source),cn=/^\s+|\s+$/g,an=/^\s+/,ln=/\s+$/,sn=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,hn=/\{\n\/\* \[wrapped with (.+)\] \*/,pn=/,? & /,_n=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,vn=/\\(\\)?/g,gn=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,dn=/\w*$/,yn=/^[-+]0x[0-9a-f]+$/i,bn=/^0b[01]+$/i,xn=/^\[object .+?Constructor\]$/,jn=/^0o[0-7]+$/i,wn=/^(?:0|[1-9]\d*)$/,mn=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,An=/($^)/,kn=/['\n\r\u2028\u2029\\]/g,En="[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?(?:\\u200d(?:[^\\ud800-\\udfff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?)*",On="(?:[\\u2700-\\u27bf]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])"+En,Sn="(?:[^\\ud800-\\udfff][\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]?|[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\ud800-\\udfff])",In=RegExp("['\u2019]","g"),Rn=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g"),zn=RegExp("\\ud83c[\\udffb-\\udfff](?=\\ud83c[\\udffb-\\udfff])|"+Sn+En,"g"),Wn=RegExp(["[A-Z\\xc0-\\xd6\\xd8-\\xde]?[a-z\\xdf-\\xf6\\xf8-\\xff]+(?:['\u2019](?:d|ll|m|re|s|t|ve))?(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde]|$)|(?:[A-Z\\xc0-\\xd6\\xd8-\\xde]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['\u2019](?:D|LL|M|RE|S|T|VE))?(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde](?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])|$)|[A-Z\\xc0-\\xd6\\xd8-\\xde]?(?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['\u2019](?:d|ll|m|re|s|t|ve))?|[A-Z\\xc0-\\xd6\\xd8-\\xde]+(?:['\u2019](?:D|LL|M|RE|S|T|VE))?|\\d*(?:(?:1ST|2ND|3RD|(?![123])\\dTH)\\b)|\\d*(?:(?:1st|2nd|3rd|(?![123])\\dth)\\b)|\\d+",On].join("|"),"g"),Bn=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]"),Ln=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Un="Array Buffer DataView Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Map Math Object Promise RegExp Set String Symbol TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array WeakMap _ clearTimeout isFinite parseInt setTimeout".split(" "),Cn={}; +Cn["[object Float32Array]"]=Cn["[object Float64Array]"]=Cn["[object Int8Array]"]=Cn["[object Int16Array]"]=Cn["[object Int32Array]"]=Cn["[object Uint8Array]"]=Cn["[object Uint8ClampedArray]"]=Cn["[object Uint16Array]"]=Cn["[object Uint32Array]"]=true,Cn["[object Arguments]"]=Cn["[object Array]"]=Cn["[object ArrayBuffer]"]=Cn["[object Boolean]"]=Cn["[object DataView]"]=Cn["[object Date]"]=Cn["[object Error]"]=Cn["[object Function]"]=Cn["[object Map]"]=Cn["[object Number]"]=Cn["[object Object]"]=Cn["[object RegExp]"]=Cn["[object Set]"]=Cn["[object String]"]=Cn["[object WeakMap]"]=false; +var Dn={};Dn["[object Arguments]"]=Dn["[object Array]"]=Dn["[object ArrayBuffer]"]=Dn["[object DataView]"]=Dn["[object Boolean]"]=Dn["[object Date]"]=Dn["[object Float32Array]"]=Dn["[object Float64Array]"]=Dn["[object Int8Array]"]=Dn["[object Int16Array]"]=Dn["[object Int32Array]"]=Dn["[object Map]"]=Dn["[object Number]"]=Dn["[object Object]"]=Dn["[object RegExp]"]=Dn["[object Set]"]=Dn["[object String]"]=Dn["[object Symbol]"]=Dn["[object Uint8Array]"]=Dn["[object Uint8ClampedArray]"]=Dn["[object Uint16Array]"]=Dn["[object Uint32Array]"]=true, +Dn["[object Error]"]=Dn["[object Function]"]=Dn["[object WeakMap]"]=false;var Mn,Tn={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},$n=parseFloat,Fn=parseInt,Nn=typeof global=="object"&&global&&global.Object===Object&&global,Pn=typeof self=="object"&&self&&self.Object===Object&&self,Zn=Nn||Pn||Function("return this")(),qn=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Vn=qn&&typeof module=="object"&&module&&!module.nodeType&&module,Kn=Vn&&Vn.exports===qn,Gn=Kn&&Nn.process; +n:{try{Mn=Gn&&Gn.binding&&Gn.binding("util");break n}catch(n){}Mn=void 0}var Hn=Mn&&Mn.isArrayBuffer,Jn=Mn&&Mn.isDate,Yn=Mn&&Mn.isMap,Qn=Mn&&Mn.isRegExp,Xn=Mn&&Mn.isSet,nt=Mn&&Mn.isTypedArray,tt=j("length"),rt=w({"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I","\xcd":"I","\xce":"I", +"\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"Ae","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss","\u0100":"A","\u0102":"A","\u0104":"A","\u0101":"a","\u0103":"a","\u0105":"a","\u0106":"C","\u0108":"C","\u010a":"C", +"\u010c":"C","\u0107":"c","\u0109":"c","\u010b":"c","\u010d":"c","\u010e":"D","\u0110":"D","\u010f":"d","\u0111":"d","\u0112":"E","\u0114":"E","\u0116":"E","\u0118":"E","\u011a":"E","\u0113":"e","\u0115":"e","\u0117":"e","\u0119":"e","\u011b":"e","\u011c":"G","\u011e":"G","\u0120":"G","\u0122":"G","\u011d":"g","\u011f":"g","\u0121":"g","\u0123":"g","\u0124":"H","\u0126":"H","\u0125":"h","\u0127":"h","\u0128":"I","\u012a":"I","\u012c":"I","\u012e":"I","\u0130":"I","\u0129":"i","\u012b":"i","\u012d":"i", +"\u012f":"i","\u0131":"i","\u0134":"J","\u0135":"j","\u0136":"K","\u0137":"k","\u0138":"k","\u0139":"L","\u013b":"L","\u013d":"L","\u013f":"L","\u0141":"L","\u013a":"l","\u013c":"l","\u013e":"l","\u0140":"l","\u0142":"l","\u0143":"N","\u0145":"N","\u0147":"N","\u014a":"N","\u0144":"n","\u0146":"n","\u0148":"n","\u014b":"n","\u014c":"O","\u014e":"O","\u0150":"O","\u014d":"o","\u014f":"o","\u0151":"o","\u0154":"R","\u0156":"R","\u0158":"R","\u0155":"r","\u0157":"r","\u0159":"r","\u015a":"S","\u015c":"S", +"\u015e":"S","\u0160":"S","\u015b":"s","\u015d":"s","\u015f":"s","\u0161":"s","\u0162":"T","\u0164":"T","\u0166":"T","\u0163":"t","\u0165":"t","\u0167":"t","\u0168":"U","\u016a":"U","\u016c":"U","\u016e":"U","\u0170":"U","\u0172":"U","\u0169":"u","\u016b":"u","\u016d":"u","\u016f":"u","\u0171":"u","\u0173":"u","\u0174":"W","\u0175":"w","\u0176":"Y","\u0177":"y","\u0178":"Y","\u0179":"Z","\u017b":"Z","\u017d":"Z","\u017a":"z","\u017c":"z","\u017e":"z","\u0132":"IJ","\u0133":"ij","\u0152":"Oe","\u0153":"oe", +"\u0149":"'n","\u017f":"s"}),et=w({"&":"&","<":"<",">":">",'"':""","'":"'"}),ut=w({"&":"&","<":"<",">":">",""":'"',"'":"'"}),it=function w(En){function On(n){if(xu(n)&&!af(n)&&!(n instanceof Mn)){if(n instanceof zn)return n;if(ci.call(n,"__wrapped__"))return Pe(n)}return new zn(n)}function Sn(){}function zn(n,t){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=F}function Mn(n){this.__wrapped__=n,this.__actions__=[],this.__dir__=1, +this.__filtered__=false,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function Tn(n){var t=-1,r=null==n?0:n.length;for(this.clear();++t=t?n:t)),n}function dt(n,t,r,e,i,o){var f,c=1&t,a=2&t,l=4&t;if(r&&(f=i?r(n,e,i,o):r(n)),f!==F)return f;if(!bu(n))return n;if(e=af(n)){if(f=Ee(n),!c)return Mr(n,f)}else{var s=yo(n),h="[object Function]"==s||"[object GeneratorFunction]"==s;if(sf(n))return Wr(n,c);if("[object Object]"==s||"[object Arguments]"==s||h&&!i){if(f=a||h?{}:Oe(n),!c)return a?Fr(n,pt(f,n)):$r(n,ht(f,n))}else{if(!Dn[s])return i?n:{};f=Se(n,s,dt,c)}}if(o||(o=new Vn), +i=o.get(n))return i;o.set(n,f);var a=l?a?ye:de:a?Uu:Lu,p=e?F:a(n);return u(p||n,function(e,u){p&&(u=e,e=n[u]),at(f,u,dt(e,t,r,u,n,o))}),f}function yt(n){var t=Lu(n);return function(r){return bt(r,n,t)}}function bt(n,t,r){var e=r.length;if(null==n)return!e;for(n=ni(n);e--;){var u=r[e],i=t[u],o=n[u];if(o===F&&!(u in n)||!i(o))return false}return true}function xt(n,t,r){if(typeof n!="function")throw new ei("Expected a function");return jo(function(){n.apply(F,r)},t)}function jt(n,t,r,e){var u=-1,i=c,o=true,f=n.length,s=[],h=t.length; +if(!f)return s;r&&(t=l(t,S(r))),e?(i=a,o=false):200<=t.length&&(i=R,o=false,t=new qn(t));n:for(;++ut}function Bt(n,t){return null!=n&&ci.call(n,t)}function Lt(n,t){return null!=n&&t in ni(n)}function Ut(n,t,r){for(var e=r?a:c,u=n[0].length,i=n.length,o=i,f=Hu(i),s=1/0,h=[];o--;){var p=n[o];o&&t&&(p=l(p,S(t))),s=Mi(p.length,s),f[o]=!r&&(t||120<=u&&120<=p.length)?new qn(o&&p):F}var p=n[0],_=-1,v=f[0];n:for(;++_t.length?n:It(n,vr(t,0,-1)),t=null==n?n:n[$e(Ge(t))],null==t?F:r(t,n,e)}function Mt(n){return xu(n)&&"[object Arguments]"==zt(n)}function Tt(n){return xu(n)&&"[object ArrayBuffer]"==zt(n)}function $t(n){return xu(n)&&"[object Date]"==zt(n)}function Ft(n,t,r,e,u){if(n===t)t=true;else if(null==n||null==t||!xu(n)&&!xu(t))t=n!==n&&t!==t;else n:{ +var i=af(n),o=af(t),f=i?"[object Array]":yo(n),c=o?"[object Array]":yo(t),f="[object Arguments]"==f?"[object Object]":f,c="[object Arguments]"==c?"[object Object]":c,a="[object Object]"==f,o="[object Object]"==c;if((c=f==c)&&sf(n)){if(!sf(t)){t=false;break n}i=true,a=false}if(c&&!a)u||(u=new Vn),t=i||gf(n)?_e(n,t,r,e,Ft,u):ve(n,t,f,r,e,Ft,u);else{if(!(1&r)&&(i=a&&ci.call(n,"__wrapped__"),f=o&&ci.call(t,"__wrapped__"),i||f)){n=i?n.value():n,t=f?t.value():t,u||(u=new Vn),t=Ft(n,t,r,e,u);break n}if(c)t:if(u||(u=new Vn), +i=1&r,f=de(n),o=f.length,c=de(t).length,o==c||i){for(a=o;a--;){var l=f[a];if(!(i?l in t:ci.call(t,l))){t=false;break t}}if((c=u.get(n))&&u.get(t))t=c==t;else{c=true,u.set(n,t),u.set(t,n);for(var s=i;++at?r:0,Re(t,r)?n[t]:F}function rr(n,t,r){var e=-1;return t=l(t.length?t:[Nu],S(je())),n=Yt(n,function(n){return{a:l(t,function(t){return t(n)}),b:++e,c:n}}),A(n,function(n,t){var e;n:{e=-1;for(var u=n.a,i=t.a,o=u.length,f=r.length;++e=f?c:c*("desc"==r[e]?-1:1); +break n}}e=n.b-t.b}return e})}function er(n,t){return ur(n,t,function(t,r){return Bu(n,r)})}function ur(n,t,r){for(var e=-1,u=t.length,i={};++et||9007199254740991t&&(t=-t>u?0:u+t),r=r>u?u:r,0>r&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0,r=Hu(u);++e=u){for(;e>>1,o=n[i];null!==o&&!Au(o)&&(r?o<=t:ot.length?n:It(n,vr(t,0,-1)), +null==n||delete n[$e(Ge(t))]}function Ar(n,t,r,e){for(var u=n.length,i=e?u:-1;(e?i--:++ie)return e?wr(n[0]):[];for(var u=-1,i=Hu(e);++u=e?n:vr(n,t,r)}function Wr(n,t){if(t)return n.slice();var r=n.length,r=yi?yi(r):new n.constructor(r);return n.copy(r),r}function Br(n){var t=new n.constructor(n.byteLength);return new di(t).set(new di(n)),t}function Lr(n,t){return new n.constructor(t?Br(n.buffer):n.buffer,n.byteOffset,n.length)}function Ur(n,t){ +if(n!==t){var r=n!==F,e=null===n,u=n===n,i=Au(n),o=t!==F,f=null===t,c=t===t,a=Au(t);if(!f&&!a&&!i&&n>t||i&&o&&c&&!f&&!a||e&&o&&c||!r&&c||!u)return 1;if(!e&&!i&&!a&&nu?F:i,u=1),t=ni(t);++eo&&f[0]!==a&&f[o-1]!==a?[]:C(f,a),o-=c.length,or?r?ar(t,n):t:(r=ar(t,Ri(n/T(t))),Bn.test(t)?zr($(r),0,n).join(""):r.slice(0,n))}function ue(n,t,e,u){function i(){for(var t=-1,c=arguments.length,a=-1,l=u.length,s=Hu(l+c),h=this&&this!==Zn&&this instanceof i?f:n;++at||e)&&(1&n&&(i[2]=h[2],t|=1&r?0:4),(r=h[3])&&(e=i[3],i[3]=e?Cr(e,r,h[4]):r,i[4]=e?C(i[3],"__lodash_placeholder__"):h[4]),(r=h[5])&&(e=i[5],i[5]=e?Dr(e,r,h[6]):r,i[6]=e?C(i[5],"__lodash_placeholder__"):h[6]),(r=h[7])&&(i[7]=r),128&n&&(i[8]=null==i[8]?h[8]:Mi(i[8],h[8])),null==i[9]&&(i[9]=h[9]),i[0]=h[0],i[1]=t),n=i[0],t=i[1], +r=i[2],e=i[3],u=i[4],f=i[9]=i[9]===F?c?0:n.length:Di(i[9]-a,0),!f&&24&t&&(t&=-25),De((h?lo:xo)(t&&1!=t?8==t||16==t?Jr(n,t,f):32!=t&&33!=t||u.length?Xr.apply(F,i):ue(n,t,r,e):Vr(n,t,r),i),n,t)}function se(n,t,r,e){return n===F||hu(n,ii[r])&&!ci.call(e,r)?t:n}function he(n,t,r,e,u,i){return bu(n)&&bu(t)&&(i.set(t,n),nr(n,t,F,he,i),i.delete(t)),n}function pe(n){return wu(n)?F:n}function _e(n,t,r,e,u,i){var o=1&r,f=n.length,c=t.length;if(f!=c&&!(o&&c>f))return false;if((c=i.get(n))&&i.get(t))return c==t;var c=-1,a=true,l=2&r?new qn:F; +for(i.set(n,t),i.set(t,n);++cr&&(r=Di(e+r,0)),g(n,je(t,3),r)):-1}function qe(n,t,r){var e=null==n?0:n.length;if(!e)return-1;var u=e-1;return r!==F&&(u=Ou(r),u=0>r?Di(e+u,0):Mi(u,e-1)), +g(n,je(t,3),u,true)}function Ve(n){return(null==n?0:n.length)?kt(n,1):[]}function Ke(n){return n&&n.length?n[0]:F}function Ge(n){var t=null==n?0:n.length;return t?n[t-1]:F}function He(n,t){return n&&n.length&&t&&t.length?or(n,t):n}function Je(n){return null==n?n:Ni.call(n)}function Ye(n){if(!n||!n.length)return[];var t=0;return n=f(n,function(n){if(_u(n))return t=Di(n.length,t),true}),E(t,function(t){return l(n,j(t))})}function Qe(n,t){if(!n||!n.length)return[];var e=Ye(n);return null==t?e:l(e,function(n){ +return r(t,F,n)})}function Xe(n){return n=On(n),n.__chain__=true,n}function nu(n,t){return t(n)}function tu(){return this}function ru(n,t){return(af(n)?u:oo)(n,je(t,3))}function eu(n,t){return(af(n)?i:fo)(n,je(t,3))}function uu(n,t){return(af(n)?l:Yt)(n,je(t,3))}function iu(n,t,r){return t=r?F:t,t=n&&null==t?n.length:t,le(n,128,F,F,F,F,t)}function ou(n,t){var r;if(typeof t!="function")throw new ei("Expected a function");return n=Ou(n),function(){return 0<--n&&(r=t.apply(this,arguments)),1>=n&&(t=F), +r}}function fu(n,t,r){return t=r?F:t,n=le(n,8,F,F,F,F,F,t),n.placeholder=fu.placeholder,n}function cu(n,t,r){return t=r?F:t,n=le(n,16,F,F,F,F,F,t),n.placeholder=cu.placeholder,n}function au(n,t,r){function e(t){var r=c,e=a;return c=a=F,_=t,s=n.apply(e,r)}function u(n){var r=n-p;return n-=_,p===F||r>=t||0>r||g&&n>=l}function i(){var n=Jo();if(u(n))return o(n);var r,e=jo;r=n-_,n=t-(n-p),r=g?Mi(n,l-r):n,h=e(i,r)}function o(n){return h=F,d&&c?e(n):(c=a=F,s)}function f(){var n=Jo(),r=u(n);if(c=arguments, +a=this,p=n,r){if(h===F)return _=n=p,h=jo(i,t),v?e(n):s;if(g)return h=jo(i,t),e(p)}return h===F&&(h=jo(i,t)),s}var c,a,l,s,h,p,_=0,v=false,g=false,d=true;if(typeof n!="function")throw new ei("Expected a function");return t=Iu(t)||0,bu(r)&&(v=!!r.leading,l=(g="maxWait"in r)?Di(Iu(r.maxWait)||0,t):l,d="trailing"in r?!!r.trailing:d),f.cancel=function(){h!==F&&ho(h),_=0,c=p=a=h=F},f.flush=function(){return h===F?s:o(Jo())},f}function lu(n,t){function r(){var e=arguments,u=t?t.apply(this,e):e[0],i=r.cache;return i.has(u)?i.get(u):(e=n.apply(this,e), +r.cache=i.set(u,e)||i,e)}if(typeof n!="function"||null!=t&&typeof t!="function")throw new ei("Expected a function");return r.cache=new(lu.Cache||Pn),r}function su(n){if(typeof n!="function")throw new ei("Expected a function");return function(){var t=arguments;switch(t.length){case 0:return!n.call(this);case 1:return!n.call(this,t[0]);case 2:return!n.call(this,t[0],t[1]);case 3:return!n.call(this,t[0],t[1],t[2])}return!n.apply(this,t)}}function hu(n,t){return n===t||n!==n&&t!==t}function pu(n){return null!=n&&yu(n.length)&&!gu(n); +}function _u(n){return xu(n)&&pu(n)}function vu(n){if(!xu(n))return false;var t=zt(n);return"[object Error]"==t||"[object DOMException]"==t||typeof n.message=="string"&&typeof n.name=="string"&&!wu(n)}function gu(n){return!!bu(n)&&(n=zt(n),"[object Function]"==n||"[object GeneratorFunction]"==n||"[object AsyncFunction]"==n||"[object Proxy]"==n)}function du(n){return typeof n=="number"&&n==Ou(n)}function yu(n){return typeof n=="number"&&-1=n}function bu(n){var t=typeof n;return null!=n&&("object"==t||"function"==t); +}function xu(n){return null!=n&&typeof n=="object"}function ju(n){return typeof n=="number"||xu(n)&&"[object Number]"==zt(n)}function wu(n){return!(!xu(n)||"[object Object]"!=zt(n))&&(n=bi(n),null===n||(n=ci.call(n,"constructor")&&n.constructor,typeof n=="function"&&n instanceof n&&fi.call(n)==hi))}function mu(n){return typeof n=="string"||!af(n)&&xu(n)&&"[object String]"==zt(n)}function Au(n){return typeof n=="symbol"||xu(n)&&"[object Symbol]"==zt(n)}function ku(n){if(!n)return[];if(pu(n))return mu(n)?$(n):Mr(n); +if(Ai&&n[Ai]){n=n[Ai]();for(var t,r=[];!(t=n.next()).done;)r.push(t.value);return r}return t=yo(n),("[object Map]"==t?L:"[object Set]"==t?D:Du)(n)}function Eu(n){return n?(n=Iu(n),n===N||n===-N?1.7976931348623157e308*(0>n?-1:1):n===n?n:0):0===n?n:0}function Ou(n){n=Eu(n);var t=n%1;return n===n?t?n-t:n:0}function Su(n){return n?gt(Ou(n),0,4294967295):0}function Iu(n){if(typeof n=="number")return n;if(Au(n))return P;if(bu(n)&&(n=typeof n.valueOf=="function"?n.valueOf():n,n=bu(n)?n+"":n),typeof n!="string")return 0===n?n:+n; +n=n.replace(cn,"");var t=bn.test(n);return t||jn.test(n)?Fn(n.slice(2),t?2:8):yn.test(n)?P:+n}function Ru(n){return Tr(n,Uu(n))}function zu(n){return null==n?"":jr(n)}function Wu(n,t,r){return n=null==n?F:It(n,t),n===F?r:n}function Bu(n,t){return null!=n&&ke(n,t,Lt)}function Lu(n){return pu(n)?Gn(n):Ht(n)}function Uu(n){if(pu(n))n=Gn(n,true);else if(bu(n)){var t,r=Le(n),e=[];for(t in n)("constructor"!=t||!r&&ci.call(n,t))&&e.push(t);n=e}else{if(t=[],null!=n)for(r in ni(n))t.push(r);n=t}return n}function Cu(n,t){ +if(null==n)return{};var r=l(ye(n),function(n){return[n]});return t=je(t),ur(n,r,function(n,r){return t(n,r[0])})}function Du(n){return null==n?[]:I(n,Lu(n))}function Mu(n){return Nf(zu(n).toLowerCase())}function Tu(n){return(n=zu(n))&&n.replace(mn,rt).replace(Rn,"")}function $u(n,t,r){return n=zu(n),t=r?F:t,t===F?Ln.test(n)?n.match(Wn)||[]:n.match(_n)||[]:n.match(t)||[]}function Fu(n){return function(){return n}}function Nu(n){return n}function Pu(n){return Gt(typeof n=="function"?n:dt(n,1))}function Zu(n,t,r){ +var e=Lu(t),i=St(t,e);null!=r||bu(t)&&(i.length||!e.length)||(r=t,t=n,n=this,i=St(t,Lu(t)));var o=!(bu(r)&&"chain"in r&&!r.chain),f=gu(n);return u(i,function(r){var e=t[r];n[r]=e,f&&(n.prototype[r]=function(){var t=this.__chain__;if(o||t){var r=n(this.__wrapped__);return(r.__actions__=Mr(this.__actions__)).push({func:e,args:arguments,thisArg:n}),r.__chain__=t,r}return e.apply(n,s([this.value()],arguments))})}),n}function qu(){}function Vu(n){return We(n)?j($e(n)):ir(n)}function Ku(){return[]}function Gu(){ +return false}En=null==En?Zn:it.defaults(Zn.Object(),En,it.pick(Zn,Un));var Hu=En.Array,Ju=En.Date,Yu=En.Error,Qu=En.Function,Xu=En.Math,ni=En.Object,ti=En.RegExp,ri=En.String,ei=En.TypeError,ui=Hu.prototype,ii=ni.prototype,oi=En["__core-js_shared__"],fi=Qu.prototype.toString,ci=ii.hasOwnProperty,ai=0,li=function(){var n=/[^.]+$/.exec(oi&&oi.keys&&oi.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}(),si=ii.toString,hi=fi.call(ni),pi=Zn._,_i=ti("^"+fi.call(ci).replace(on,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),vi=Kn?En.Buffer:F,gi=En.Symbol,di=En.Uint8Array,yi=vi?vi.f:F,bi=U(ni.getPrototypeOf,ni),xi=ni.create,ji=ii.propertyIsEnumerable,wi=ui.splice,mi=gi?gi.isConcatSpreadable:F,Ai=gi?gi.iterator:F,ki=gi?gi.toStringTag:F,Ei=function(){ +try{var n=Ae(ni,"defineProperty");return n({},"",{}),n}catch(n){}}(),Oi=En.clearTimeout!==Zn.clearTimeout&&En.clearTimeout,Si=Ju&&Ju.now!==Zn.Date.now&&Ju.now,Ii=En.setTimeout!==Zn.setTimeout&&En.setTimeout,Ri=Xu.ceil,zi=Xu.floor,Wi=ni.getOwnPropertySymbols,Bi=vi?vi.isBuffer:F,Li=En.isFinite,Ui=ui.join,Ci=U(ni.keys,ni),Di=Xu.max,Mi=Xu.min,Ti=Ju.now,$i=En.parseInt,Fi=Xu.random,Ni=ui.reverse,Pi=Ae(En,"DataView"),Zi=Ae(En,"Map"),qi=Ae(En,"Promise"),Vi=Ae(En,"Set"),Ki=Ae(En,"WeakMap"),Gi=Ae(ni,"create"),Hi=Ki&&new Ki,Ji={},Yi=Fe(Pi),Qi=Fe(Zi),Xi=Fe(qi),no=Fe(Vi),to=Fe(Ki),ro=gi?gi.prototype:F,eo=ro?ro.valueOf:F,uo=ro?ro.toString:F,io=function(){ +function n(){}return function(t){return bu(t)?xi?xi(t):(n.prototype=t,t=new n,n.prototype=F,t):{}}}();On.templateSettings={escape:Q,evaluate:X,interpolate:nn,variable:"",imports:{_:On}},On.prototype=Sn.prototype,On.prototype.constructor=On,zn.prototype=io(Sn.prototype),zn.prototype.constructor=zn,Mn.prototype=io(Sn.prototype),Mn.prototype.constructor=Mn,Tn.prototype.clear=function(){this.__data__=Gi?Gi(null):{},this.size=0},Tn.prototype.delete=function(n){return n=this.has(n)&&delete this.__data__[n], +this.size-=n?1:0,n},Tn.prototype.get=function(n){var t=this.__data__;return Gi?(n=t[n],"__lodash_hash_undefined__"===n?F:n):ci.call(t,n)?t[n]:F},Tn.prototype.has=function(n){var t=this.__data__;return Gi?t[n]!==F:ci.call(t,n)},Tn.prototype.set=function(n,t){var r=this.__data__;return this.size+=this.has(n)?0:1,r[n]=Gi&&t===F?"__lodash_hash_undefined__":t,this},Nn.prototype.clear=function(){this.__data__=[],this.size=0},Nn.prototype.delete=function(n){var t=this.__data__;return n=lt(t,n),!(0>n)&&(n==t.length-1?t.pop():wi.call(t,n,1), +--this.size,true)},Nn.prototype.get=function(n){var t=this.__data__;return n=lt(t,n),0>n?F:t[n][1]},Nn.prototype.has=function(n){return-1e?(++this.size,r.push([n,t])):r[e][1]=t,this},Pn.prototype.clear=function(){this.size=0,this.__data__={hash:new Tn,map:new(Zi||Nn),string:new Tn}},Pn.prototype.delete=function(n){return n=we(this,n).delete(n),this.size-=n?1:0,n},Pn.prototype.get=function(n){return we(this,n).get(n); +},Pn.prototype.has=function(n){return we(this,n).has(n)},Pn.prototype.set=function(n,t){var r=we(this,n),e=r.size;return r.set(n,t),this.size+=r.size==e?0:1,this},qn.prototype.add=qn.prototype.push=function(n){return this.__data__.set(n,"__lodash_hash_undefined__"),this},qn.prototype.has=function(n){return this.__data__.has(n)},Vn.prototype.clear=function(){this.__data__=new Nn,this.size=0},Vn.prototype.delete=function(n){var t=this.__data__;return n=t.delete(n),this.size=t.size,n},Vn.prototype.get=function(n){ +return this.__data__.get(n)},Vn.prototype.has=function(n){return this.__data__.has(n)},Vn.prototype.set=function(n,t){var r=this.__data__;if(r instanceof Nn){var e=r.__data__;if(!Zi||199>e.length)return e.push([n,t]),this.size=++r.size,this;r=this.__data__=new Pn(e)}return r.set(n,t),this.size=r.size,this};var oo=Zr(Et),fo=Zr(Ot,true),co=qr(),ao=qr(true),lo=Hi?function(n,t){return Hi.set(n,t),n}:Nu,so=Ei?function(n,t){return Ei(n,"toString",{configurable:true,enumerable:false,value:Fu(t),writable:true})}:Nu,ho=Oi||function(n){ +return Zn.clearTimeout(n)},po=Vi&&1/D(new Vi([,-0]))[1]==N?function(n){return new Vi(n)}:qu,_o=Hi?function(n){return Hi.get(n)}:qu,vo=Wi?function(n){return null==n?[]:(n=ni(n),f(Wi(n),function(t){return ji.call(n,t)}))}:Ku,go=Wi?function(n){for(var t=[];n;)s(t,vo(n)),n=bi(n);return t}:Ku,yo=zt;(Pi&&"[object DataView]"!=yo(new Pi(new ArrayBuffer(1)))||Zi&&"[object Map]"!=yo(new Zi)||qi&&"[object Promise]"!=yo(qi.resolve())||Vi&&"[object Set]"!=yo(new Vi)||Ki&&"[object WeakMap]"!=yo(new Ki))&&(yo=function(n){ +var t=zt(n);if(n=(n="[object Object]"==t?n.constructor:F)?Fe(n):"")switch(n){case Yi:return"[object DataView]";case Qi:return"[object Map]";case Xi:return"[object Promise]";case no:return"[object Set]";case to:return"[object WeakMap]"}return t});var bo=oi?gu:Gu,xo=Me(lo),jo=Ii||function(n,t){return Zn.setTimeout(n,t)},wo=Me(so),mo=function(n){n=lu(n,function(n){return 500===t.size&&t.clear(),n});var t=n.cache;return n}(function(n){var t=[];return en.test(n)&&t.push(""),n.replace(un,function(n,r,e,u){ +t.push(e?u.replace(vn,"$1"):r||n)}),t}),Ao=lr(function(n,t){return _u(n)?jt(n,kt(t,1,_u,true)):[]}),ko=lr(function(n,t){var r=Ge(t);return _u(r)&&(r=F),_u(n)?jt(n,kt(t,1,_u,true),je(r,2)):[]}),Eo=lr(function(n,t){var r=Ge(t);return _u(r)&&(r=F),_u(n)?jt(n,kt(t,1,_u,true),F,r):[]}),Oo=lr(function(n){var t=l(n,Sr);return t.length&&t[0]===n[0]?Ut(t):[]}),So=lr(function(n){var t=Ge(n),r=l(n,Sr);return t===Ge(r)?t=F:r.pop(),r.length&&r[0]===n[0]?Ut(r,je(t,2)):[]}),Io=lr(function(n){var t=Ge(n),r=l(n,Sr);return(t=typeof t=="function"?t:F)&&r.pop(), +r.length&&r[0]===n[0]?Ut(r,F,t):[]}),Ro=lr(He),zo=ge(function(n,t){var r=null==n?0:n.length,e=vt(n,t);return fr(n,l(t,function(n){return Re(n,r)?+n:n}).sort(Ur)),e}),Wo=lr(function(n){return wr(kt(n,1,_u,true))}),Bo=lr(function(n){var t=Ge(n);return _u(t)&&(t=F),wr(kt(n,1,_u,true),je(t,2))}),Lo=lr(function(n){var t=Ge(n),t=typeof t=="function"?t:F;return wr(kt(n,1,_u,true),F,t)}),Uo=lr(function(n,t){return _u(n)?jt(n,t):[]}),Co=lr(function(n){return Er(f(n,_u))}),Do=lr(function(n){var t=Ge(n);return _u(t)&&(t=F), +Er(f(n,_u),je(t,2))}),Mo=lr(function(n){var t=Ge(n),t=typeof t=="function"?t:F;return Er(f(n,_u),F,t)}),To=lr(Ye),$o=lr(function(n){var t=n.length,t=1=t}),cf=Mt(function(){return arguments}())?Mt:function(n){return xu(n)&&ci.call(n,"callee")&&!ji.call(n,"callee")},af=Hu.isArray,lf=Hn?S(Hn):Tt,sf=Bi||Gu,hf=Jn?S(Jn):$t,pf=Yn?S(Yn):Nt,_f=Qn?S(Qn):qt,vf=Xn?S(Xn):Vt,gf=nt?S(nt):Kt,df=oe(Jt),yf=oe(function(n,t){return n<=t}),bf=Pr(function(n,t){ +if(Le(t)||pu(t))Tr(t,Lu(t),n);else for(var r in t)ci.call(t,r)&&at(n,r,t[r])}),xf=Pr(function(n,t){Tr(t,Uu(t),n)}),jf=Pr(function(n,t,r,e){Tr(t,Uu(t),n,e)}),wf=Pr(function(n,t,r,e){Tr(t,Lu(t),n,e)}),mf=ge(vt),Af=lr(function(n){return n.push(F,se),r(jf,F,n)}),kf=lr(function(n){return n.push(F,he),r(Rf,F,n)}),Ef=ne(function(n,t,r){n[t]=r},Fu(Nu)),Of=ne(function(n,t,r){ci.call(n,t)?n[t].push(r):n[t]=[r]},je),Sf=lr(Dt),If=Pr(function(n,t,r){nr(n,t,r)}),Rf=Pr(function(n,t,r,e){nr(n,t,r,e)}),zf=ge(function(n,t){ +var r={};if(null==n)return r;var e=false;t=l(t,function(t){return t=Rr(t,n),e||(e=1--n)return t.apply(this,arguments)}},On.ary=iu,On.assign=bf,On.assignIn=xf,On.assignInWith=jf,On.assignWith=wf,On.at=mf,On.before=ou,On.bind=Yo,On.bindAll=Zf,On.bindKey=Qo,On.castArray=function(){if(!arguments.length)return[];var n=arguments[0];return af(n)?n:[n]}, +On.chain=Xe,On.chunk=function(n,t,r){if(t=(r?ze(n,t,r):t===F)?1:Di(Ou(t),0),r=null==n?0:n.length,!r||1>t)return[];for(var e=0,u=0,i=Hu(Ri(r/t));et?0:t,e)):[]},On.dropRight=function(n,t,r){var e=null==n?0:n.length;return e?(t=r||t===F?1:Ou(t),t=e-t,vr(n,0,0>t?0:t)):[]},On.dropRightWhile=function(n,t){return n&&n.length?Ar(n,je(t,3),true,true):[]},On.dropWhile=function(n,t){return n&&n.length?Ar(n,je(t,3),true):[]},On.fill=function(n,t,r,e){var u=null==n?0:n.length;if(!u)return[];for(r&&typeof r!="number"&&ze(n,t,r)&&(r=0,e=u),u=n.length,r=Ou(r),0>r&&(r=-r>u?0:u+r),e=e===F||e>u?u:Ou(e),0>e&&(e+=u),e=r>e?0:Su(e);r>>0,r?(n=zu(n))&&(typeof t=="string"||null!=t&&!_f(t))&&(t=jr(t), +!t&&Bn.test(n))?zr($(n),0,r):n.split(t,r):[]},On.spread=function(n,t){if(typeof n!="function")throw new ei("Expected a function");return t=null==t?0:Di(Ou(t),0),lr(function(e){var u=e[t];return e=zr(e,0,t),u&&s(e,u),r(n,this,e)})},On.tail=function(n){var t=null==n?0:n.length;return t?vr(n,1,t):[]},On.take=function(n,t,r){return n&&n.length?(t=r||t===F?1:Ou(t),vr(n,0,0>t?0:t)):[]},On.takeRight=function(n,t,r){var e=null==n?0:n.length;return e?(t=r||t===F?1:Ou(t),t=e-t,vr(n,0>t?0:t,e)):[]},On.takeRightWhile=function(n,t){ +return n&&n.length?Ar(n,je(t,3),false,true):[]},On.takeWhile=function(n,t){return n&&n.length?Ar(n,je(t,3)):[]},On.tap=function(n,t){return t(n),n},On.throttle=function(n,t,r){var e=true,u=true;if(typeof n!="function")throw new ei("Expected a function");return bu(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u),au(n,t,{leading:e,maxWait:t,trailing:u})},On.thru=nu,On.toArray=ku,On.toPairs=Bf,On.toPairsIn=Lf,On.toPath=function(n){return af(n)?l(n,$e):Au(n)?[n]:Mr(mo(zu(n)))},On.toPlainObject=Ru, +On.transform=function(n,t,r){var e=af(n),i=e||sf(n)||gf(n);if(t=je(t,4),null==r){var o=n&&n.constructor;r=i?e?new o:[]:bu(n)&&gu(o)?io(bi(n)):{}}return(i?u:Et)(n,function(n,e,u){return t(r,n,e,u)}),r},On.unary=function(n){return iu(n,1)},On.union=Wo,On.unionBy=Bo,On.unionWith=Lo,On.uniq=function(n){return n&&n.length?wr(n):[]},On.uniqBy=function(n,t){return n&&n.length?wr(n,je(t,2)):[]},On.uniqWith=function(n,t){return t=typeof t=="function"?t:F,n&&n.length?wr(n,F,t):[]},On.unset=function(n,t){return null==n||mr(n,t); +},On.unzip=Ye,On.unzipWith=Qe,On.update=function(n,t,r){return null==n?n:pr(n,t,Ir(r)(It(n,t)),void 0)},On.updateWith=function(n,t,r,e){return e=typeof e=="function"?e:F,null!=n&&(n=pr(n,t,Ir(r)(It(n,t)),e)),n},On.values=Du,On.valuesIn=function(n){return null==n?[]:I(n,Uu(n))},On.without=Uo,On.words=$u,On.wrap=function(n,t){return rf(Ir(t),n)},On.xor=Co,On.xorBy=Do,On.xorWith=Mo,On.zip=To,On.zipObject=function(n,t){return Or(n||[],t||[],at)},On.zipObjectDeep=function(n,t){return Or(n||[],t||[],pr); +},On.zipWith=$o,On.entries=Bf,On.entriesIn=Lf,On.extend=xf,On.extendWith=jf,Zu(On,On),On.add=nc,On.attempt=Pf,On.camelCase=Uf,On.capitalize=Mu,On.ceil=tc,On.clamp=function(n,t,r){return r===F&&(r=t,t=F),r!==F&&(r=Iu(r),r=r===r?r:0),t!==F&&(t=Iu(t),t=t===t?t:0),gt(Iu(n),t,r)},On.clone=function(n){return dt(n,4)},On.cloneDeep=function(n){return dt(n,5)},On.cloneDeepWith=function(n,t){return t=typeof t=="function"?t:F,dt(n,5,t)},On.cloneWith=function(n,t){return t=typeof t=="function"?t:F,dt(n,4,t)}, +On.conformsTo=function(n,t){return null==t||bt(n,t,Lu(t))},On.deburr=Tu,On.defaultTo=function(n,t){return null==n||n!==n?t:n},On.divide=rc,On.endsWith=function(n,t,r){n=zu(n),t=jr(t);var e=n.length,e=r=r===F?e:gt(Ou(r),0,e);return r-=t.length,0<=r&&n.slice(r,e)==t},On.eq=hu,On.escape=function(n){return(n=zu(n))&&Y.test(n)?n.replace(H,et):n},On.escapeRegExp=function(n){return(n=zu(n))&&fn.test(n)?n.replace(on,"\\$&"):n},On.every=function(n,t,r){var e=af(n)?o:wt;return r&&ze(n,t,r)&&(t=F),e(n,je(t,3)); +},On.find=Po,On.findIndex=Ze,On.findKey=function(n,t){return v(n,je(t,3),Et)},On.findLast=Zo,On.findLastIndex=qe,On.findLastKey=function(n,t){return v(n,je(t,3),Ot)},On.floor=ec,On.forEach=ru,On.forEachRight=eu,On.forIn=function(n,t){return null==n?n:co(n,je(t,3),Uu)},On.forInRight=function(n,t){return null==n?n:ao(n,je(t,3),Uu)},On.forOwn=function(n,t){return n&&Et(n,je(t,3))},On.forOwnRight=function(n,t){return n&&Ot(n,je(t,3))},On.get=Wu,On.gt=of,On.gte=ff,On.has=function(n,t){return null!=n&&ke(n,t,Bt); +},On.hasIn=Bu,On.head=Ke,On.identity=Nu,On.includes=function(n,t,r,e){return n=pu(n)?n:Du(n),r=r&&!e?Ou(r):0,e=n.length,0>r&&(r=Di(e+r,0)),mu(n)?r<=e&&-1r&&(r=Di(e+r,0)),d(n,t,r)):-1},On.inRange=function(n,t,r){return t=Eu(t),r===F?(r=t,t=0):r=Eu(r),n=Iu(n),n>=Mi(t,r)&&n=n},On.isSet=vf,On.isString=mu,On.isSymbol=Au,On.isTypedArray=gf,On.isUndefined=function(n){return n===F},On.isWeakMap=function(n){return xu(n)&&"[object WeakMap]"==yo(n)},On.isWeakSet=function(n){return xu(n)&&"[object WeakSet]"==zt(n)},On.join=function(n,t){ +return null==n?"":Ui.call(n,t)},On.kebabCase=Cf,On.last=Ge,On.lastIndexOf=function(n,t,r){var e=null==n?0:n.length;if(!e)return-1;var u=e;if(r!==F&&(u=Ou(r),u=0>u?Di(e+u,0):Mi(u,e-1)),t===t){for(r=u+1;r--&&n[r]!==t;);n=r}else n=g(n,b,u,true);return n},On.lowerCase=Df,On.lowerFirst=Mf,On.lt=df,On.lte=yf,On.max=function(n){return n&&n.length?mt(n,Nu,Wt):F},On.maxBy=function(n,t){return n&&n.length?mt(n,je(t,2),Wt):F},On.mean=function(n){return x(n,Nu)},On.meanBy=function(n,t){return x(n,je(t,2))},On.min=function(n){ +return n&&n.length?mt(n,Nu,Jt):F},On.minBy=function(n,t){return n&&n.length?mt(n,je(t,2),Jt):F},On.stubArray=Ku,On.stubFalse=Gu,On.stubObject=function(){return{}},On.stubString=function(){return""},On.stubTrue=function(){return true},On.multiply=uc,On.nth=function(n,t){return n&&n.length?tr(n,Ou(t)):F},On.noConflict=function(){return Zn._===this&&(Zn._=pi),this},On.noop=qu,On.now=Jo,On.pad=function(n,t,r){n=zu(n);var e=(t=Ou(t))?T(n):0;return!t||e>=t?n:(t=(t-e)/2,ee(zi(t),r)+n+ee(Ri(t),r))},On.padEnd=function(n,t,r){ +n=zu(n);var e=(t=Ou(t))?T(n):0;return t&&et){var e=n;n=t,t=e}return r||n%1||t%1?(r=Fi(),Mi(n+r*(t-n+$n("1e-"+((r+"").length-1))),t)):cr(n,t); +},On.reduce=function(n,t,r){var e=af(n)?h:m,u=3>arguments.length;return e(n,je(t,4),r,u,oo)},On.reduceRight=function(n,t,r){var e=af(n)?p:m,u=3>arguments.length;return e(n,je(t,4),r,u,fo)},On.repeat=function(n,t,r){return t=(r?ze(n,t,r):t===F)?1:Ou(t),ar(zu(n),t)},On.replace=function(){var n=arguments,t=zu(n[0]);return 3>n.length?t:t.replace(n[1],n[2])},On.result=function(n,t,r){t=Rr(t,n);var e=-1,u=t.length;for(u||(u=1,n=F);++en||9007199254740991=i)return n;if(i=r-T(e),1>i)return e; +if(r=o?zr(o,0,i).join(""):n.slice(0,i),u===F)return r+e;if(o&&(i+=r.length-i),_f(u)){if(n.slice(i).search(u)){var f=r;for(u.global||(u=ti(u.source,zu(dn.exec(u))+"g")),u.lastIndex=0;o=u.exec(f);)var c=o.index;r=r.slice(0,c===F?i:c)}}else n.indexOf(jr(u),i)!=i&&(u=r.lastIndexOf(u),-1e.__dir__?"Right":"")}),e},Mn.prototype[n+"Right"]=function(t){ +return this.reverse()[n](t).reverse()}}),u(["filter","map","takeWhile"],function(n,t){var r=t+1,e=1==r||3==r;Mn.prototype[n]=function(n){var t=this.clone();return t.__iteratees__.push({iteratee:je(n,3),type:r}),t.__filtered__=t.__filtered__||e,t}}),u(["head","last"],function(n,t){var r="take"+(t?"Right":"");Mn.prototype[n]=function(){return this[r](1).value()[0]}}),u(["initial","tail"],function(n,t){var r="drop"+(t?"":"Right");Mn.prototype[n]=function(){return this.__filtered__?new Mn(this):this[r](1); +}}),Mn.prototype.compact=function(){return this.filter(Nu)},Mn.prototype.find=function(n){return this.filter(n).head()},Mn.prototype.findLast=function(n){return this.reverse().find(n)},Mn.prototype.invokeMap=lr(function(n,t){return typeof n=="function"?new Mn(this):this.map(function(r){return Dt(r,n,t)})}),Mn.prototype.reject=function(n){return this.filter(su(je(n)))},Mn.prototype.slice=function(n,t){n=Ou(n);var r=this;return r.__filtered__&&(0t)?new Mn(r):(0>n?r=r.takeRight(-n):n&&(r=r.drop(n)), +t!==F&&(t=Ou(t),r=0>t?r.dropRight(-t):r.take(t-n)),r)},Mn.prototype.takeRightWhile=function(n){return this.reverse().takeWhile(n).reverse()},Mn.prototype.toArray=function(){return this.take(4294967295)},Et(Mn.prototype,function(n,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),e=/^(?:head|last)$/.test(t),u=On[e?"take"+("last"==t?"Right":""):t],i=e||/^find/.test(t);u&&(On.prototype[t]=function(){function t(n){return n=u.apply(On,s([n],f)),e&&h?n[0]:n}var o=this.__wrapped__,f=e?[1]:arguments,c=o instanceof Mn,a=f[0],l=c||af(o); +l&&r&&typeof a=="function"&&1!=a.length&&(c=l=false);var h=this.__chain__,p=!!this.__actions__.length,a=i&&!h,c=c&&!p;return!i&&l?(o=c?o:new Mn(this),o=n.apply(o,f),o.__actions__.push({func:nu,args:[t],thisArg:F}),new zn(o,h)):a&&c?n.apply(this,f):(o=this.thru(t),a?e?o.value()[0]:o.value():o)})}),u("pop push shift sort splice unshift".split(" "),function(n){var t=ui[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:pop|shift)$/.test(n);On.prototype[n]=function(){var n=arguments;if(e&&!this.__chain__){ +var u=this.value();return t.apply(af(u)?u:[],n)}return this[r](function(r){return t.apply(af(r)?r:[],n)})}}),Et(Mn.prototype,function(n,t){var r=On[t];if(r){var e=r.name+"";(Ji[e]||(Ji[e]=[])).push({name:t,func:r})}}),Ji[Xr(F,2).name]=[{name:"wrapper",func:F}],Mn.prototype.clone=function(){var n=new Mn(this.__wrapped__);return n.__actions__=Mr(this.__actions__),n.__dir__=this.__dir__,n.__filtered__=this.__filtered__,n.__iteratees__=Mr(this.__iteratees__),n.__takeCount__=this.__takeCount__,n.__views__=Mr(this.__views__), +n},Mn.prototype.reverse=function(){if(this.__filtered__){var n=new Mn(this);n.__dir__=-1,n.__filtered__=true}else n=this.clone(),n.__dir__*=-1;return n},Mn.prototype.value=function(){var n,t=this.__wrapped__.value(),r=this.__dir__,e=af(t),u=0>r,i=e?t.length:0;n=i;for(var o=this.__views__,f=0,c=-1,a=o.length;++c=this.__values__.length;return{done:n,value:n?F:this.__values__[this.__index__++]}},On.prototype.plant=function(n){for(var t,r=this;r instanceof Sn;){var e=Pe(r);e.__index__=0,e.__values__=F,t?u.__wrapped__=e:t=e;var u=e,r=r.__wrapped__}return u.__wrapped__=n,t},On.prototype.reverse=function(){var n=this.__wrapped__;return n instanceof Mn?(this.__actions__.length&&(n=new Mn(this)),n=n.reverse(),n.__actions__.push({func:nu,args:[Je],thisArg:F}),new zn(n,this.__chain__)):this.thru(Je); +},On.prototype.toJSON=On.prototype.valueOf=On.prototype.value=function(){return kr(this.__wrapped__,this.__actions__)},On.prototype.first=On.prototype.head,Ai&&(On.prototype[Ai]=tu),On}();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Zn._=it, define(function(){return it})):Vn?((Vn.exports=it)._=it,qn._=it):Zn._=it}).call(this); \ No newline at end of file diff --git a/page/2/index.html b/page/2/index.html new file mode 100644 index 00000000..7a698634 --- /dev/null +++ b/page/2/index.html @@ -0,0 +1,2907 @@ + + + + + + + + + + + + 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+ +
+ +
+
+ +
+ +

+ Six ways to improve communication skills +

+
+ +
+ + Six ways to improve communication skills + +
+ +
+ +
+ +

+ Overcoming the Forgetting Curve +

+
+ +
+ + Overcoming the Forgetting Curve + +
+ +
+ +
+ +

+ Undo a Git merge that hasn't been pushed yet +

+
+ +
+ + Undo a Git merge that hasn't been pushed yet + +
+ +
+ +
+ +

+ Specify a timeout using a non-blocking method +

+
+ +
+ + Specify a timeout using a non-blocking method + +
+ +
+ +
+ +

+ How to reverse a list of words in a shell string? +

+
+ +
+ + How to reverse a list of words in a shell string? + +
+ +
+ +
+ +

+ Generate CA certificates for Java +

+
+ +
+ + Generate CA certificates for Java + +
+ +
+ +
+ +

+ Systemd analyze +

+
+ +
+ + Systemd analyze + +
+ +
+ +
+ +

+ Java build information +

+
+ +
+ + Java build information + +
+ +
+ +
+ +

+ Editor Config +

+
+ +
+ + Editor Config + +
+ +
+ +
+ +

+ CQRS LDC +

+
+ +
+ + CQRS LDC + +
+ +
+ +
+ +

+ Kubernetes API Reference +

+
+ +
+ + Kubernetes API Reference + +
+ +
+ +
+ +

+ Dragon Kill Point +

+
+ +
+ + Dragon Kill Point (DKP) + +
+ +
+ +
+ +

+ Design Principle +

+
+ +
+ + Design Principle + +
+ +
+ +
+ +

+ REST API Error Handling Best Practices +

+
+ +
+ + REST API Error Handling Best Practices + +
+ +
+ +
+ +

+ iptables +

+
+ +
+ + iptables + +
+ +
+ +
+ +

+ Frequently used Java arguments +

+
+ +
+ + Frequently used Java arguments + +
+ +
+ +
+ +

+ Java Memory Map +

+
+ +
+ + Java Memory Map + +
+ +
+ +
+ +

+ OpenJDK Life Cycle +

+
+ +
+ + OpenJDK Life Cycle + +
+ +
+ +
+ +

+ Buildah, Skopeo and Podman +

+
+ +
+ + Buildah, Skopeo and Podman + +
+ +
+ +
+ +

+ Eight tips for business negotiation +

+
+ +
+ + Eight tips for business negotiation + +
+ +
+ +
+ +

+ Aile iterative lean design +

+
+ +
+ + Aile iterative lean design + +
+ +
+ +
+ +

+ Systemd's Journal Size +

+
+ +
+ + Systemd's Journal Size + +
+ +
+ +
+ +

+ JPA Entity Life Cycle +

+
+ +
+ + JPA Entity Life Cycle + +
+ +
+ +
+ +

+ Java 7 concurrent executors UML class diagram +

+
+ +
+ + Java 7 concurrent executors UML class diagram + +
+ +
+ +
+ +

+ Design patterns card +

+
+ +
+ + Design patterns card + +
+ +
+ +
+ +

+ Turn Off Windows Fast Startup +

+
+ +
+ + Turn Off Windows Fast Startup + +
+ +
+ +
+ +

+ Block Chain +

+
+ +
+ + Block Chain + +
+ +
+ +
+ +

+ Portable Hardware Locality +

+
+ +
+ + Portable Hardware Locality + +
+ +
+ +
+ +

+ Drop Linux Cache +

+
+ +
+ + Drop Linux Cache + +
+ +
+ +
+ +

+ The Schema of Azure Event Grid +

+
+ +
+ + The Schema of Azure Event Grid + +
+ +
+ +
+ +

+ Windows 10 Kit +

+
+ +
+ + Windows 10 Kit + +
+ +
+ +
+ +

+ Remove blank element from json +

+
+ +
+ + Remove blank (null or empty) element from json via jq + +
+ +
+ +
+ +

+ ULID and TSID +

+
+ +
+ + universally unique lexicographically sortable identifier (ULID), trend sorted identifier generator (TSID) + +
+ +
+ +
+ +

+ Sorted base64 algorithm +

+
+ +
+ + Sorted base64 algorithm without padding bytes + +
+ +
+ +
+ +

+ MySQL Aggregate Function GROUP_CONCAT() +

+
+ +
+ + MySQL Aggregate Function GROUP_CONCAT() + +
+ +
+ +
+ +

+ TCC principle +

+
+ +
+ + TCC principle + +
+ +
+ +
+ +

+ Undertow web server +

+
+ +
+ + Undertow web server + +
+ +
+ +
+ +

+ Diagram of UML and SysML +

+
+ +
+ + Diagram of UML and SysML + +
+ +
+ +
+ +

+ RBAC principle +

+
+ +
+ + RBAC principle + +
+ +
+ +
+ +

+ VXLAN on Bare Metal +

+
+ +
+ + VXLAN on Bare Metal + +
+ +
+ +
+ +

+ IPv4 Multicast technology +

+
+ +
+ + IPv4 Multicast technology + +
+ +
+ +
+ +

+ 自我管理 +

+
+ +
+ + 自我管理 + +
+ +
+ +
+ +

+ Mersenne Twister - a verfy fast random number generator +

+
+ +
+ + A very fast random number generator of period 2^19937-1 + +
+ +
+ +
+ +

+ Pagination query +

+
+ +
+ + Pagination query + +
+ +
+ +
+ +

+ Lean management +

+
+ +
+ + Lean management + +
+ +
+ +
+ +

+ CMCC IPv6 +

+
+ +
+ + CMCC IPv6 + +
+ +
+ +
+ +

+ Moving average +

+
+ +
+ + Moving average + +
+ +
+ +
+ +

+ Docker authentication information in the Kubernetes secret +

+
+ +
+ + Docker login information in the Kubernetes secret + +
+ +
+ +
+ +

+ 4+1 Architectural View Model +

+
+ +
+ + 4+1 Architectural View Model + +
+ +
+ +
+ +

+ ANSI Escape Sequences Colors +

+
+ +
+ + ANSI Escape Sequences Colors + +
+ +
+ +
+ +

+ Circular Dependencies in Spring +

+
+ +
+ + Circular Dependencies in Spring + +
+ +
+ +
+ +

+ nghttpx http proxy +

+
+ +
+ + nghttpx http proxy + +
+ +
+ +
+ +

+ Helm Template random value +

+
+ +
+ + Helm Template random value + +
+ +
+ +
+ +

+ Kubernetes API Reference +

+
+ +
+ + Distributed System Design + +
+ +
+ +
+ +

+ RISC-V program development using QEMU +

+
+ +
+ + RISC-V program development using QEMU + +
+ +
+ +
+ +

+ Manually generate the Java root certificate +

+
+ +
+ + Manually generate the Java root certificate + +
+ +
+ +
+ +

+ Distributed System Design +

+
+ +
+ + Distributed System Design + +
+ +
+ +
+ +

+ Running Ceph inside Docker +

+
+ +
+ + Containerize Ceph + +
+ +
+ +
+ +

+ SCM +

+
+ +
+ + 供应链管理系统 + +
+ +
+ +
+ +

+ DynamIQ - From big.LITTLE to big.Middle.LITTLE +

+
+ +
+ + big.LITTLE 技术作为 DynamIQ 的一部分,从而可以形成更复杂的异构处理技术 + +
+ +
+ +
+ +

+ 未来20年的12个趋势 +

+
+ +
+ + 未来20年的12个趋势,哪些行业正处于红利期,所有生意的本质是什么? + +
+ +
+ +
+ +

+ 常见的 Windows 启动程序位置 +

+
+ +
+ + 如何从常见的 Windows 启动程序位置找到并且删除项目,或者增加启动程序 + +
+ +
+ +
+ +

+ Windows 命令行窗口的启动目录 +

+
+ +
+ + 描述 Windows 命令行窗口的启动目录的位置,以及修改方法 + +
+ +
+ +
+ +

+ NewSQL +

+
+ +
+ + NewSQL 的核心特性:支持 SQL,ACID 事务语义,在 OLTP 场景下具备 NoSQL 的高性能、高可用、高扩展性 + +
+ +
+ +
+ +

+ 并发编程概述 +

+
+ +
+ + 并发编程领域可以抽象成三个核心问题:分工、同步和互斥 + +
+ +
+ +
+ +

+ 为 Hadoop 编译 Linux 和 Windows 本机程序 +

+
+ +
+ + 为 Hadoop 编译 Linux 和 Windows 本机程序 + +
+ +
+ +
+ +

+ Hadoop Native +

+
+ +
+ + Hadoop Native for Linux and Windows + +
+ +
+ +
+ +
+ +
+
+ +
+ Prev +
+ + +
+
+ + + +
+ +
+ + + + + diff --git a/style.css b/style.css new file mode 100644 index 00000000..1b4c5719 --- /dev/null +++ b/style.css @@ -0,0 +1,837 @@ +@charset "UTF-8"; +html { + background-color: #f4f5f5; } + +body { + font-family: "SF Pro SC","SF Pro Text","SF Pro Icons","PingFang SC","Helvetica Neue","Helvetica","Arial",sans-serif; + margin: 0; + display: flex; + flex-direction: column; + min-height: 100vh; + background-color: #f4f5f5; } + +a { + text-decoration: none; + cursor: pointer; + color: #909090; } + +main { + flex-grow: 1; + display: flex; + max-width: 1000px; + padding: 0 16px; + margin: 0 auto; } + +.article-category { + display: inline-block; } + +footer .copyright { + max-width: 1000px; + padding: 0 16px; + margin: 0 auto; + display: flex; + line-height: 3em; + color: #BABABA; } + footer .copyright a:hover { + color: #007fff; } + +header { + background: #fff; + border-bottom: 1px solid #f1f1f1; + color: #909090; + margin-bottom: 15px; + box-shadow: 0 2px 5px -2px rgba(0, 0, 0, 0.05); } + header .header-container { + max-width: 1000px; + padding: 0 16px; + margin: 0 auto; + display: flex; + font-size: 1.15em; + justify-content: space-between; + align-items: center; + height: 60px; } + header .header-container .logo { + color: #007fff; } + header .header-container .right-header { + margin: 0; + padding: 0; } + header .header-container .right-header li { + list-style: none; + display: inline-block; + padding: 0 18px; } + header .header-container .right-header li:last-child { + padding-right: 25px; } + header .header-container .right-header .nav-item .active { + color: #007fff; } + +@media (max-width: 700px) { + header .right-header li.nav-item { + padding: 0 0 0 5px; } + header .right-header li.nav-item:last-child { + padding-right: 0; } } + +.post-meta .tag { + position: relative; + padding-right: 4px; } + .post-meta .tag:not(:last-of-type)::after { + content: '·'; + position: absolute; + right: -4px; } + .post-meta .tag:hover::after { + color: #6E7173; } + +#archive { + width: 1000px; } + #archive .content { + width: 66%; + background-color: #ffffff; + border-radius: 2px; + box-shadow: 0 2px 5px -2px rgba(0, 0, 0, 0.05); + overflow: hidden; + box-sizing: border-box; + align-self: flex-start; } + #archive .content .year-list { + padding: 20px 25px 15px; + border-bottom: 1px solid rgba(178, 186, 194, 0.15); } + #archive .content .year-list h3 { + margin: 0 0 5px; + color: #404040; + font-size: 25px; } + #archive .content .year-list ul { + margin: 0; + color: #404040; + font-weight: 200; + padding-left: 0; } + #archive .content .year-list ul li { + list-style: none; + margin-bottom: 10px; } + #archive .content .year-list ul li time { + text-align: right; } + #archive .content .year-list ul li a { + margin-left: 10px; + font-weight: normal; + transition: 0.3s color; } + #archive .content .year-list ul li a:hover { + color: #007fff; } + +@media (min-width: 1032px) { + #archive { + width: 1000px; } } + +@media (max-width: 1032px) { + #archive { + width: 100%; + box-sizing: border-box; } } + +@media (max-width: 700px) { + #archive .content { + width: 100%; } } + +#post { + width: 1000px; } + #post .content article { + width: 66%; + background-color: #ffffff; + border-radius: 2px; + box-shadow: 0 2px 5px -2px rgba(0, 0, 0, 0.05); + overflow: hidden; + box-sizing: border-box; + width: 100%; + padding: 20px 25px; + border-bottom: 1px solid rgba(178, 186, 194, 0.15); + border-bottom-left-radius: 0; + border-bottom-right-radius: 0; } + #post .content > .comment { + width: 66%; + background-color: #ffffff; + border-radius: 2px; + box-shadow: 0 2px 5px -2px rgba(0, 0, 0, 0.05); + overflow: hidden; + box-sizing: border-box; + width: 100%; + padding: 20px 25px; + border-top-left-radius: 0; + border-top-right-radius: 0; } + #post .content .post-meta { + font-size: 14px; + font-weight: 200; + color: #6E7173; + margin-bottom: 11px; + font-family: "SF Pro SC","SF Pro Text","SF Pro Icons","PingFang SC","Helvetica Neue","Helvetica","Arial",sans-serif; } + #post .content .post-meta a { + color: #404040; + font-size: 14px; + font-weight: 200; } + #post .content .post-meta a:hover { + color: #007fff; } + #post > .content { + width: 66%; } + #post aside { + flex-basis: 34%; } + #post aside .toc-container { + margin-left: 15px; + box-sizing: border-box; + background-color: #ffffff; + position: sticky; + top: 15px; + align-self: flex-start; } + #post aside .toc-container h1 { + font-size: 1.1em; + padding-left: 20px; + margin: 0; + height: 45px; + line-height: 45px; + box-sizing: border-box; + border-bottom: 1px solid rgba(178, 186, 194, 0.15); + font-weight: normal; } + #post aside .toc-container .content { + padding: 20px; + font-size: 1em; } + #post aside .toc-container ol { + list-style: none; } + #post aside .toc-container ol.toc { + margin: 0; + padding-left: 0; } + #post aside .toc-container ol.toc .toc-level-1 > ol { + padding-left: 1.1em; } + #post aside .toc-container ol.toc .toc-level-2 > ol { + padding-left: 1.2em; } + #post aside .toc-container ol.toc .toc-level-3 > ol { + padding-left: 2em; } + #post aside .toc-container ol a { + transition: 0.3s color; } + #post aside .toc-container ol a:hover, #post aside .toc-container ol a.active { + color: #007fff; } + +@media (min-width: 1032px) { + #post { + width: 1000px; } } + +@media (max-width: 1032px) { + #post { + width: 100%; + box-sizing: border-box; } } + +@media (max-width: 700px) { + #post { + flex-direction: column; } + #post > .content { + order: 1; + width: 100%; } + #post aside { + order: 0; } + #post aside .toc-container { + margin-left: 0; } + #post aside .toc-container ol a.active { + color: #909090; } + #post aside > div { + margin-left: 0; + margin-bottom: 15px; } } + +.markdown-body { + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; + font-size: 16px; + line-height: 1.5; + word-wrap: break-word; } + .markdown-body a { + color: #0366d6; } + .markdown-body figure { + margin: 0; } + .markdown-body figure table { + background-color: #f6f8fa; } + .markdown-body figure table td.code { + padding: 0; + border: none; } + .markdown-body::before { + display: table; + content: ""; } + .markdown-body::after { + display: table; + clear: both; + content: ""; } + .markdown-body > *:first-child { + margin-top: 0 !important; } + .markdown-body > *:last-child { + margin-bottom: 0 !important; } + .markdown-body a:not([href]) { + color: inherit; + text-decoration: none; } + .markdown-body .absent { + color: #cb2431; } + .markdown-body .anchor { + float: left; + padding-right: 4px; + margin-left: -20px; + line-height: 1; } + .markdown-body .anchor:focus { + outline: none; } + .markdown-body p, + .markdown-body blockquote, + .markdown-body ul, + .markdown-body ol, + .markdown-body dl, + .markdown-body table, + .markdown-body pre { + margin-top: 0; + margin-bottom: 16px; } + .markdown-body hr { + height: 0.25em; + padding: 0; + margin: 24px 0; + background-color: #e1e4e8; + border: 0; } + .markdown-body blockquote { + padding: 0 1em; + margin-left: 0; + color: #6a737d; + border-left: 0.25em solid #dfe2e5; } + .markdown-body blockquote > :first-child { + margin-top: 0; } + .markdown-body blockquote > :last-child { + margin-bottom: 0; } + .markdown-body kbd { + display: inline-block; + padding: 3px 5px; + font-size: 11px; + line-height: 10px; + color: #444d56; + vertical-align: middle; + background-color: #fafbfc; + border: solid 1px #c6cbd1; + border-bottom-color: #959da5; + border-radius: 3px; + box-shadow: inset 0 -1px 0 #959da5; } + .markdown-body h1, + .markdown-body h2, + .markdown-body h3, + .markdown-body h4, + .markdown-body h5, + .markdown-body h6 { + margin-top: 24px; + margin-bottom: 16px; + font-weight: 600; + line-height: 1.25; } + .markdown-body h1 .octicon-link, + .markdown-body h2 .octicon-link, + .markdown-body h3 .octicon-link, + .markdown-body h4 .octicon-link, + .markdown-body h5 .octicon-link, + .markdown-body h6 .octicon-link { + color: #1b1f23; + vertical-align: middle; + visibility: hidden; } + .markdown-body h1:hover .anchor, + .markdown-body h2:hover .anchor, + .markdown-body h3:hover .anchor, + .markdown-body h4:hover .anchor, + .markdown-body h5:hover .anchor, + .markdown-body h6:hover .anchor { + text-decoration: none; } + .markdown-body h1:hover .anchor .octicon-link, + .markdown-body h2:hover .anchor .octicon-link, + .markdown-body h3:hover .anchor .octicon-link, + .markdown-body h4:hover .anchor .octicon-link, + .markdown-body h5:hover .anchor .octicon-link, + .markdown-body h6:hover .anchor .octicon-link { + visibility: visible; } + .markdown-body h1 tt, + .markdown-body h1 code, + .markdown-body h2 tt, + .markdown-body h2 code, + .markdown-body h3 tt, + .markdown-body h3 code, + .markdown-body h4 tt, + .markdown-body h4 code, + .markdown-body h5 tt, + .markdown-body h5 code, + .markdown-body h6 tt, + .markdown-body h6 code { + font-size: inherit; } + .markdown-body h1 { + padding-bottom: 0.3em; + font-size: 2em; + border-bottom: 1px solid #eaecef; } + .markdown-body h2 { + padding-bottom: 0.3em; + font-size: 1.5em; + border-bottom: 1px solid #eaecef; } + .markdown-body h3 { + font-size: 1.25em; } + .markdown-body h4 { + font-size: 1em; } + .markdown-body h5 { + font-size: 0.875em; } + .markdown-body h6 { + font-size: 0.85em; + color: #6a737d; } + .markdown-body ul, + .markdown-body ol { + padding-left: 2em; } + .markdown-body ul.no-list, + .markdown-body ol.no-list { + padding: 0; + list-style-type: none; } + .markdown-body ul ul, + .markdown-body ul ol, + .markdown-body ol ol, + .markdown-body ol ul { + margin-top: 0; + margin-bottom: 0; } + .markdown-body li > p { + margin-top: 16px; } + .markdown-body li + li { + margin-top: 0.25em; } + .markdown-body dl { + padding: 0; } + .markdown-body dl dt { + padding: 0; + margin-top: 16px; + font-size: 1em; + font-style: italic; + font-weight: 600; } + .markdown-body dl dd { + padding: 0 16px; + margin-bottom: 16px; } + .markdown-body table { + display: block; + width: 100%; + overflow: auto; + border-collapse: collapse; } + .markdown-body table th { + font-weight: 600; } + .markdown-body table th, + .markdown-body table td { + padding: 6px 13px; + border: 1px solid #dfe2e5; } + .markdown-body table tr { + background-color: #fff; + border-top: 1px solid #c6cbd1; } + .markdown-body table tr:nth-child(2n) { + background-color: #f6f8fa; } + .markdown-body table img { + background-color: transparent; } + .markdown-body img { + max-width: 100%; + box-sizing: content-box; + background-color: #fff; } + .markdown-body img[align=right] { + padding-left: 20px; } + .markdown-body img[align=left] { + padding-right: 20px; } + .markdown-body .emoji { + max-width: none; + vertical-align: text-top; + background-color: transparent; } + .markdown-body span.frame { + display: block; + overflow: hidden; } + .markdown-body span.frame > span { + display: block; + float: left; + width: auto; + padding: 7px; + margin: 13px 0 0; + overflow: hidden; + border: 1px solid #dfe2e5; } + .markdown-body span.frame span img { + display: block; + float: left; } + .markdown-body span.frame span span { + display: block; + padding: 5px 0 0; + clear: both; + color: #24292e; } + .markdown-body span.align-center { + display: block; + overflow: hidden; + clear: both; } + .markdown-body span.align-center > span { + display: block; + margin: 13px auto 0; + overflow: hidden; + text-align: center; } + .markdown-body span.align-center span img { + margin: 0 auto; + text-align: center; } + .markdown-body span.align-right { + display: block; + overflow: hidden; + clear: both; } + .markdown-body span.align-right > span { + display: block; + margin: 13px 0 0; + overflow: hidden; + text-align: right; } + .markdown-body span.align-right span img { + margin: 0; + text-align: right; } + .markdown-body span.float-left { + display: block; + float: left; + margin-right: 13px; + overflow: hidden; } + .markdown-body span.float-left span { + margin: 13px 0 0; } + .markdown-body span.float-right { + display: block; + float: right; + margin-left: 13px; + overflow: hidden; } + .markdown-body span.float-right > span { + display: block; + margin: 13px auto 0; + overflow: hidden; + text-align: right; } + .markdown-body code, + .markdown-body tt { + padding: 0; + padding-top: 0.2em; + padding-bottom: 0.2em; + margin: 0; + font-size: 85%; + background-color: rgba(27, 31, 35, 0.05); + border-radius: 3px; } + .markdown-body code::before, + .markdown-body code::after, + .markdown-body tt::before, + .markdown-body tt::after { + letter-spacing: -0.2em; + content: "\00a0"; } + .markdown-body code br, + .markdown-body tt br { + display: none; } + .markdown-body del code { + text-decoration: inherit; } + .markdown-body pre { + word-wrap: normal; } + .markdown-body pre > code { + padding: 0; + margin: 0; + font-size: 100%; + word-break: normal; + white-space: pre; + background: transparent; + border: 0; } + .markdown-body .highlight { + margin-bottom: 16px; } + .markdown-body .highlight table tr { + border-top: none; + background-color: transparent; } + .markdown-body .highlight table td { + padding: 0; + border: none; } + .markdown-body .highlight table td .line { + height: 17px; } + .markdown-body .highlight table .gutter pre { + padding-right: 0; } + .markdown-body .highlight table .code { + vertical-align: top; } + .markdown-body .highlight pre { + margin-bottom: 0; + word-break: normal; } + .markdown-body .highlight pre, + .markdown-body pre { + padding: 16px; + overflow: auto; + font-size: 85%; + line-height: 1.45; + background-color: #f6f8fa; + border-radius: 3px; } + .markdown-body pre code, + .markdown-body pre tt { + display: inline; + max-width: auto; + padding: 0; + margin: 0; + overflow: visible; + line-height: inherit; + word-wrap: normal; + background-color: transparent; + border: 0; } + .markdown-body pre code::before, + .markdown-body pre code::after, + .markdown-body pre tt::before, + .markdown-body pre tt::after { + content: normal; } + .markdown-body .csv-data td, + .markdown-body .csv-data th { + padding: 5px; + overflow: hidden; + font-size: 12px; + line-height: 1; + text-align: left; + white-space: nowrap; } + .markdown-body .csv-data .blob-num { + padding: 10px 8px 9px; + text-align: right; + background: #fff; + border: 0; } + .markdown-body .csv-data tr { + border-top: 0; } + .markdown-body .csv-data th { + font-weight: 600; + background: #f6f8fa; + border-top: 0; } + .markdown-body .code .comment, + .markdown-body .code .meta { + color: #969896; } + .markdown-body .code .string, + .markdown-body .code .variable, + .markdown-body .code .template-variable, + .markdown-body .code .strong, + .markdown-body .code .emphasis, + .markdown-body .code .quote { + color: #df5000; } + .markdown-body .code .keyword, + .markdown-body .code .selector-tag, + .markdown-body .code .type { + color: #a71d5d; } + .markdown-body .code .literal, + .markdown-body .code .symbol, + .markdown-body .code .bullet, + .markdown-body .code .attribute { + color: #0086b3; } + .markdown-body .code .section, + .markdown-body .code .name { + color: #63a35c; } + .markdown-body .code .tag { + color: #333333; } + .markdown-body .code .title, + .markdown-body .code .attr, + .markdown-body .code .selector-id, + .markdown-body .code .selector-class, + .markdown-body .code .selector-attr, + .markdown-body .code .selector-pseudo { + color: #795da3; } + .markdown-body .code .addition { + color: #55a532; + background-color: #eaffea; } + .markdown-body .code .deletion { + color: #bd2c00; + background-color: #ffecec; } + .markdown-body .code .link { + text-decoration: underline; } + +#index li { + list-style: none; } + +#index .posts-list { + width: 66%; + background-color: #ffffff; + border-radius: 2px; + box-shadow: 0 2px 5px -2px rgba(0, 0, 0, 0.05); + overflow: hidden; + box-sizing: border-box; + flex-basis: 66%; + align-self: flex-start; } + #index .posts-list section { + padding: 20px 25px; + border-bottom: 1px solid rgba(178, 186, 194, 0.15); } + #index .posts-list section a { + color: #404040; } + #index .posts-list section a:hover { + color: #007fff; } + #index .posts-list section a h3 { + margin: 0 0 5px; + font-size: 25px; + font-weight: 700; + transition: 0.3s color; } + #index .posts-list section .post-img { + margin-bottom: 5px; + transition: 0.3s color; } + #index .posts-list section .post-img img { + width: 100%; + vertical-align: middle; } + #index .posts-list section .post-content { + color: #a3a3a3; + margin-bottom: 8px; } + #index .posts-list section .post-content * { + margin: 0; + padding: 0; + text-align: justify; } + #index .posts-list section .post-meta { + font-size: 14px; + font-weight: 200; + color: #6E7173; } + #index .posts-list section .post-meta .seperator { + padding: 0 2px; } + +#index aside { + position: sticky; + top: 15px; + flex-basis: 34%; } + #index aside > div { + margin-left: 15px; + box-sizing: border-box; + background-color: #ffffff; + margin-bottom: 15px; + box-sizing: border-box; + border-radius: 2px; } + #index aside > div h1 { + font-size: 1.1em; + padding-left: 20px; + margin: 0; + height: 45px; + line-height: 45px; + box-sizing: border-box; + border-bottom: 1px solid rgba(178, 186, 194, 0.15); + font-weight: normal; } + #index aside > div > .content { + color: #909090; + padding: 20px; + font-size: 1em; } + #index aside > div > .content a { + color: #909090; + transition: 0.3s color; } + #index aside > div > .content a:hover { + color: #007fff; } + #index aside .search form input { + background: #fff 8px 9px no-repeat url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAANCAYAAABy6%2BR8AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAIGNIUk0AAG11AABzoAAA%2FN0AAINkAABw6AAA7GgAADA%2BAAAQkOTsmeoAAAESSURBVHjajNCxS9VRGMbxz71E4OwgoXPQxVEpXCI47%2BZqGP0LCoJO7UVD3QZzb3SwcHB7F3Uw3Zpd%2FAPCcJKG7Dj4u%2FK7Pwp94HDg5Xyf5z1Pr9YKImKANTzFXxzjU2ae6qhXaxURr%2FAFl9hHDy%2FwEK8z89sYVEp5gh84wMvMvGiSJ%2FEV85jNzLMR1McqfmN5BEBmnmMJFSvtpH7jdJiZv7q7Z%2BZPfMdcF6rN%2FT%2F1m2LGBkd4HhFT3dcRMY2FpskxaLNpayciHrWAGeziD7b%2BVfkithuTk8bkGa4wgWFmbrSTZOYeBvjc%2BucQj%2FEe6xHx4Taq1nrnKaW8K6XUUsrHWuvNevdRRLzFGwzvDbXAB9cDAHvhedDruuxSAAAAAElFTkSuQmCC); + padding: 7px 11px 7px 28px; + border-radius: 2px; + width: 100%; + box-sizing: border-box; + border: 1px solid rgba(178, 186, 194, 0.3); + outline: none; + font-size: 14px; } + #index aside .avatar { + overflow: hidden; } + #index aside .avatar img { + display: block; + width: 100%; + height: 185px; + object-fit: cover; + object-position: center center; } + #index aside .categories .category-list { + padding-left: 0; + margin: 0; } + #index aside .categories .category-list-child { + padding-left: 1.3em; } + #index aside .categories .category-list-child li { + list-style: disc; } + #index aside .links a { + display: block; } + +.paging { + max-width: 1000px; + padding: 0 16px; + margin: 0 auto; + padding-top: 1em; } + .paging .paging-container { + display: flex; + justify-content: space-between; + width: 66%; } + .paging .paging-container > div { + display: inline-block; + border-radius: 2px; + font-size: 14px; + transition: 0.3s color; } + .paging .paging-container > div a { + display: inline-block; + padding: 5px 15px; } + .paging .paging-container > div:hover { + border-color: #999; } + .paging .paging-container .page-prev { + border: 1px solid #ddd; } + .paging .paging-container .page-next { + text-align: right; + border: 1px solid #ddd; } + +@media (min-width: 1032px) { + #index { + width: 1000px; } + .paging { + width: 1000px; } } + +@media (max-width: 1032px) { + .paging { + width: 100%; + box-sizing: border-box; } } + +@media (max-width: 700px) { + #index { + flex-direction: column; } + #index .posts-list { + order: 1; + width: 100%; } + #index aside { + position: static; + order: 0; } + #index aside > div { + margin-left: 0; } + .paging .paging-container { + width: 100%; } } + +#tags .tags-container { + width: 66%; + background-color: #ffffff; + border-radius: 2px; + box-shadow: 0 2px 5px -2px rgba(0, 0, 0, 0.05); + overflow: hidden; + box-sizing: border-box; + width: 66%; + padding: 0; } + +#tags .tags { + padding: 25px 25px 20px; + border-bottom: 1px solid rgba(178, 186, 194, 0.15); } + #tags .tags a, + #tags .tags .tag { + display: inline-block; + padding: 0 10px; + line-height: 1.6em; + font-size: 14px; + text-decoration: none; + margin-bottom: 6px; + cursor: pointer; + border: 1px solid #6E7173; + border-radius: 20px; + color: #404040; + font-weight: 200; + transition: all 0.1s; } + #tags .tags a:hover, #tags .tags a:active, + #tags .tags .tag:hover, + #tags .tags .tag:active { + color: white; + border-color: #007fff; + background-color: #007fff; } + +#tags .tag-list { + padding: 20px 25px 15px; + border-bottom: 1px solid rgba(178, 186, 194, 0.15); } + #tags .tag-list .listing-seperator { + color: #007fff; } + #tags .tag-list .listing-seperator .tag-text { + font-weight: 200; + line-height: 1.7; } + #tags .tag-list .post-preview { + margin-left: 16px; } + #tags .tag-list .post-preview h2.post-title { + color: #404040; + transition: 0.3s color; } + #tags .tag-list .post-preview h2.post-title:hover { + color: #007fff; } + +#tags .post-preview { + position: relative; } + #tags .post-preview > .post-meta { + position: absolute; + right: 5px; + bottom: 0px; + margin: 0px; + font-size: 12px; + line-height: 12px; } + #tags .post-preview > a .post-title { + font-size: 16px; + font-weight: 500; + margin-top: 20px; } + #tags .post-preview > a .post-subtitle { + font-size: 12px; } + +@media (min-width: 1032px) { + #tags { + width: 1000px; } } + +@media (max-width: 700px) { + #tags .tags-container { + width: 100%; } } diff --git a/tags/Architecture/index.html b/tags/Architecture/index.html new file mode 100644 index 00000000..02deb361 --- /dev/null +++ b/tags/Architecture/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+ +
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ +
+ +
+ + + + + diff --git a/tags/Arm/index.html b/tags/Arm/index.html new file mode 100644 index 00000000..02deb361 --- /dev/null +++ b/tags/Arm/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+ +
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ +
+ +
+ + + + + diff --git a/tags/C-C/index.html b/tags/C-C/index.html new file mode 100644 index 00000000..02deb361 --- /dev/null +++ b/tags/C-C/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+ +
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ +
+ +
+ + + + + diff --git a/tags/C/index.html b/tags/C/index.html new file mode 100644 index 00000000..02deb361 --- /dev/null +++ b/tags/C/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+ +
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ +
+ +
+ + + + + diff --git a/tags/CQRS/index.html b/tags/CQRS/index.html new file mode 100644 index 00000000..02deb361 --- /dev/null +++ b/tags/CQRS/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+ +
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ +
+ +
+ + + + + diff --git a/tags/Cloud/index.html b/tags/Cloud/index.html new file mode 100644 index 00000000..02deb361 --- /dev/null +++ b/tags/Cloud/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+ +
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ +
+ +
+ + + + + diff --git a/tags/Concurrent/index.html b/tags/Concurrent/index.html new file mode 100644 index 00000000..02deb361 --- /dev/null +++ b/tags/Concurrent/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+ +
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ +
+ +
+ + + + + diff --git a/tags/Container/index.html b/tags/Container/index.html new file mode 100644 index 00000000..02deb361 --- /dev/null +++ b/tags/Container/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+ +
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ +
+ +
+ + + + + diff --git a/tags/Dart/index.html b/tags/Dart/index.html new file mode 100644 index 00000000..02deb361 --- /dev/null +++ b/tags/Dart/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+ +
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ +
+ +
+ + + + + diff --git a/tags/FreeBSD/index.html b/tags/FreeBSD/index.html new file mode 100644 index 00000000..02deb361 --- /dev/null +++ b/tags/FreeBSD/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+ +
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ +
+ +
+ + + + + diff --git a/tags/Git/index.html b/tags/Git/index.html new file mode 100644 index 00000000..02deb361 --- /dev/null +++ b/tags/Git/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+ +
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ +
+ +
+ + + + + diff --git a/tags/HTTP/index.html b/tags/HTTP/index.html new file mode 100644 index 00000000..02deb361 --- /dev/null +++ b/tags/HTTP/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+ +
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ +
+ +
+ + + + + diff --git a/tags/Hadoop/index.html b/tags/Hadoop/index.html new file mode 100644 index 00000000..02deb361 --- /dev/null +++ b/tags/Hadoop/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+ +
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ +
+ +
+ + + + + diff --git a/tags/Haskell/index.html b/tags/Haskell/index.html new file mode 100644 index 00000000..02deb361 --- /dev/null +++ b/tags/Haskell/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+ +
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ +
+ +
+ + + + + diff --git a/tags/IDE/index.html b/tags/IDE/index.html new file mode 100644 index 00000000..02deb361 --- /dev/null +++ b/tags/IDE/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+ +
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ +
+ +
+ + + + + diff --git a/tags/IP/index.html b/tags/IP/index.html new file mode 100644 index 00000000..02deb361 --- /dev/null +++ b/tags/IP/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+ +
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ +
+ +
+ + + + + diff --git a/tags/IPv4/index.html b/tags/IPv4/index.html new file mode 100644 index 00000000..02deb361 --- /dev/null +++ b/tags/IPv4/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+ +
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ +
+ +
+ + + + + diff --git a/tags/IPv6/index.html b/tags/IPv6/index.html new file mode 100644 index 00000000..02deb361 --- /dev/null +++ b/tags/IPv6/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+ +
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ +
+ +
+ + + + + diff --git a/tags/Industry/index.html b/tags/Industry/index.html new file mode 100644 index 00000000..02deb361 --- /dev/null +++ b/tags/Industry/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+ +
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ +
+ +
+ + + + + diff --git a/tags/JSON/index.html b/tags/JSON/index.html new file mode 100644 index 00000000..02deb361 --- /dev/null +++ b/tags/JSON/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+ +
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ +
+ +
+ + + + + diff --git a/tags/Java/index.html b/tags/Java/index.html new file mode 100644 index 00000000..02deb361 --- /dev/null +++ b/tags/Java/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+ +
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ +
+ +
+ + + + + diff --git a/tags/Julia/index.html b/tags/Julia/index.html new file mode 100644 index 00000000..02deb361 --- /dev/null +++ b/tags/Julia/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+ +
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ +
+ +
+ + + + + diff --git a/tags/Kubernetes/index.html b/tags/Kubernetes/index.html new file mode 100644 index 00000000..02deb361 --- /dev/null +++ b/tags/Kubernetes/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+ +
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ +
+ +
+ + + + + diff --git a/tags/Linux/index.html b/tags/Linux/index.html new file mode 100644 index 00000000..02deb361 --- /dev/null +++ b/tags/Linux/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+ +
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ +
+ +
+ + + + + diff --git a/tags/MIPS/index.html b/tags/MIPS/index.html new file mode 100644 index 00000000..02deb361 --- /dev/null +++ b/tags/MIPS/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+ +
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ +
+ +
+ + + + + diff --git a/tags/NET/index.html b/tags/NET/index.html new file mode 100644 index 00000000..02deb361 --- /dev/null +++ b/tags/NET/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+ +
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ +
+ +
+ + + + + diff --git a/tags/NetBSD/index.html b/tags/NetBSD/index.html new file mode 100644 index 00000000..02deb361 --- /dev/null +++ b/tags/NetBSD/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+ +
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ +
+ +
+ + + + + diff --git a/tags/NewSQL/index.html b/tags/NewSQL/index.html new file mode 100644 index 00000000..02deb361 --- /dev/null +++ b/tags/NewSQL/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+ +
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ +
+ +
+ + + + + diff --git a/tags/OpenBSD/index.html b/tags/OpenBSD/index.html new file mode 100644 index 00000000..02deb361 --- /dev/null +++ b/tags/OpenBSD/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+ +
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ +
+ +
+ + + + + diff --git a/tags/Operating-system/index.html b/tags/Operating-system/index.html new file mode 100644 index 00000000..02deb361 --- /dev/null +++ b/tags/Operating-system/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+ +
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ +
+ +
+ + + + + diff --git a/tags/Principle/index.html b/tags/Principle/index.html new file mode 100644 index 00000000..02deb361 --- /dev/null +++ b/tags/Principle/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+ +
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ +
+ +
+ + + + + diff --git a/tags/Programming/index.html b/tags/Programming/index.html new file mode 100644 index 00000000..02deb361 --- /dev/null +++ b/tags/Programming/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+ +
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ +
+ +
+ + + + + diff --git a/tags/Python/index.html b/tags/Python/index.html new file mode 100644 index 00000000..02deb361 --- /dev/null +++ b/tags/Python/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+ +
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ +
+ +
+ + + + + diff --git a/tags/QEMU/index.html b/tags/QEMU/index.html new file mode 100644 index 00000000..02deb361 --- /dev/null +++ b/tags/QEMU/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+ +
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ +
+ +
+ + + + + diff --git a/tags/RBAC/index.html b/tags/RBAC/index.html new file mode 100644 index 00000000..02deb361 --- /dev/null +++ b/tags/RBAC/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+ +
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ +
+ +
+ + + + + diff --git a/tags/REST/index.html b/tags/REST/index.html new file mode 100644 index 00000000..02deb361 --- /dev/null +++ b/tags/REST/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+ +
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ +
+ +
+ + + + + diff --git a/tags/RISC-V/index.html b/tags/RISC-V/index.html new file mode 100644 index 00000000..02deb361 --- /dev/null +++ b/tags/RISC-V/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+ +
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ +
+ +
+ + + + + diff --git a/tags/Randomization/index.html b/tags/Randomization/index.html new file mode 100644 index 00000000..02deb361 --- /dev/null +++ b/tags/Randomization/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+ +
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ +
+ +
+ + + + + diff --git a/tags/Rust/index.html b/tags/Rust/index.html new file mode 100644 index 00000000..02deb361 --- /dev/null +++ b/tags/Rust/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+ +
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ +
+ +
+ + + + + diff --git a/tags/SQL/index.html b/tags/SQL/index.html new file mode 100644 index 00000000..02deb361 --- /dev/null +++ b/tags/SQL/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+ +
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ +
+ +
+ + + + + diff --git a/tags/Security/index.html b/tags/Security/index.html new file mode 100644 index 00000000..02deb361 --- /dev/null +++ b/tags/Security/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+ +
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ +
+ +
+ + + + + diff --git a/tags/Trends/index.html b/tags/Trends/index.html new file mode 100644 index 00000000..02deb361 --- /dev/null +++ b/tags/Trends/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+ +
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ +
+ +
+ + + + + diff --git a/tags/UML/index.html b/tags/UML/index.html new file mode 100644 index 00000000..02deb361 --- /dev/null +++ b/tags/UML/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+ +
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ +
+ +
+ + + + + diff --git a/tags/VSCode/index.html b/tags/VSCode/index.html new file mode 100644 index 00000000..02deb361 --- /dev/null +++ b/tags/VSCode/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+ +
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ +
+ +
+ + + + + diff --git a/tags/WASM/index.html b/tags/WASM/index.html new file mode 100644 index 00000000..02deb361 --- /dev/null +++ b/tags/WASM/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+ +
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ +
+ +
+ + + + + diff --git a/tags/Windows/index.html b/tags/Windows/index.html new file mode 100644 index 00000000..02deb361 --- /dev/null +++ b/tags/Windows/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+ +
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ +
+ +
+ + + + + diff --git a/tags/Zig/index.html b/tags/Zig/index.html new file mode 100644 index 00000000..02deb361 --- /dev/null +++ b/tags/Zig/index.html @@ -0,0 +1,1635 @@ + + + + + + + + + + + + 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+ +
+ +
+
+ + + + + + +
+

2022

+ +
+ +
+

2021

+ +
+ +
+

2020

+ +
+ +
+

2019

+ +
+ + + +
+
+ +
+ +
+ + + + + diff --git a/tags/index.html b/tags/index.html new file mode 100644 index 00000000..2f9f0826 --- /dev/null +++ b/tags/index.html @@ -0,0 +1,3358 @@ + + + + + + + + + + + + 标签 | 上下未形,何由考之?冥昭瞢暗,誰能極之?馮翼惟象,何以識之? + + + + + + + + + + + +
+ +
+ +
+
+
+ + Cloud + + Hadoop + + Programming + + Java + + Concurrent + + SQL + + NewSQL + + Windows + + Trends + + Arm + + Container + + Architecture + + Security + + RISC-V + + QEMU + + Linux + + Kubernetes + + HTTP + + IP + + IPv6 + + Randomization + + IPv4 + + RBAC + + UML + + JSON + + REST + + CQRS + + IDE + + Git + + Rust + + C/C++ + + Python + + Operating system + + VSCode + + MIPS + + .NET + + Zig + + FreeBSD + + NetBSD + + OpenBSD + + Industry + + Principle + + Haskell + + Dart + + Julia + + C + + WASM + +
+ + + + + +
+ + Programming + + +
+ +

+ 并发编程概述 +

+ +
+ +
+ +
+ +

+ NewSQL +

+ +
+ +
+ +
+ +

+ 常见的 Windows 启动程序位置 +

+ +
+ +
+ +
+ +

+ Manually generate the Java root certificate +

+ +
+ +
+ +
+ +

+ nghttpx http proxy +

+ +
+ +
+ +
+ +

+ Mersenne Twister - a verfy fast random number generator +

+ +
+ +
+ +
+ +

+ Pagination query +

+ +
+ +
+ +
+ +

+ IPv4 Multicast technology +

+ +
+ +
+ +
+ +

+ VXLAN on Bare Metal +

+ +
+ +
+ +
+ +

+ MySQL Aggregate Function GROUP_CONCAT() +

+ +
+ +
+ +
+ +

+ Java 7 concurrent executors UML class diagram +

+ +
+ +
+ +
+ +

+ JPA Entity Life Cycle +

+ +
+ +
+ +
+ +

+ Cargo Source Replacement +

+ +
+ +
+ +
+ +

+ NDK console program +

+ +
+ +
+ +
+ +

+ Compile rsync by NDK +

+ +
+ +
+ +
+ +

+ Rsync backup for Android device +

+ +
+ +
+ +
+ +

+ Build BusyBox in Docker +

+ +
+ +
+ +
+ +

+ Welcome to Cython +

+ +
+ +
+ +
+ +

+ Quickly generate certificates by OpenSSL +

+ +
+ +
+ +
+ +

+ ASGI: Async Python Web Ecosystem +

+ +
+ +
+ +
+ +

+ Build Boost on Windows +

+ +
+ +
+ +
+ +

+ SQL insert on conflict +

+ +
+ +
+ +
+ +

+ pg metrics +

+ +
+ +
+ +
+ +

+ Vultr API Quickstart +

+ +
+ +
+ +
+ +

+ Get Started Flyway in 5 minutes +

+ +
+ +
+ +
+ +

+ .NET Core Life Cycle +

+ +
+ +
+ +
+ +

+ Performance of ZooKeeper Lock +

+ +
+ +
+ +
+ +

+ Open source mirrors +

+ +
+ +
+ +
+ +

+ Zig Programming Language Quick Start +

+ +
+ +
+ +
+ +

+ Haskell Programming Language +

+ +
+ +
+ +
+ +

+ Cross compiling Rust for Windows MSVC target +

+ +
+ +
+ +
+ +

+ Cross compiling Rust and Running with QEMU or Wine +

+ +
+ +
+ +
+ +

+ Statically Linked Executable Hardening with PIE +

+ +
+ +
+ +
+ +

+ Dart programming language +

+ +
+ +
+ +
+ +

+ Time of Haskell +

+ +
+ +
+ +
+ +

+ .NET on Linux +

+ +
+ +
+ +
+ +

+ Benefits of Learning Haskell +

+ +
+ +
+ +
+ +

+ Julia Data Types +

+ +
+ +
+ +
+ +

+ REST API backend by Julia with Genie +

+ +
+ +
+ +
+ +

+ OpenMP 5.1 with Vital Usability Enhancements +

+ +
+ +
+ +
+ +

+ Getting the Git Timing Right +

+ +
+ +
+ +
+ +

+ Visualization with Matplotlib +

+ +
+ +
+ +
+ +

+ SCTP over UDP in the Linux kernel +

+ +
+ +
+ +
+ +

+ HikariCP and PostgreSQL +

+ +
+ +
+ +
+ +

+ Spring Native: What, Why and How +

+ +
+ +
+ +
+ + + +
+ + Concurrent + + +
+ +

+ 并发编程概述 +

+ +
+ +
+ +
+ + + +
+ + NewSQL + + +
+ +

+ NewSQL +

+ +
+ +
+ +
+ + + + + + + + + + + + + + + + + +
+ + Linux + + +
+ +

+ RISC-V program development using QEMU +

+ +
+ +
+ +
+ +

+ ANSI Escape Sequences Colors +

+ +
+ +
+ +
+ +

+ Drop Linux Cache +

+ +
+ +
+ +
+ +

+ Portable Hardware Locality +

+ +
+ +
+ +
+ +

+ Systemd's Journal Size +

+ +
+ +
+ +
+ +

+ iptables +

+ +
+ +
+ +
+ +

+ Systemd analyze +

+ +
+ +
+ +
+ +

+ How to reverse a list of words in a shell string? +

+ +
+ +
+ +
+ +

+ SSH Proxy and Forwarding +

+ +
+ +
+ +
+ +

+ Linux Desktop Entry +

+ +
+ +
+ +
+ +

+ Setup SSH SOCKS5 proxy for Chrome +

+ +
+ +
+ +
+ +

+ GPT Partition +

+ +
+ +
+ +
+ +

+ go-ipfs 0.4.23 released +

+ +
+ +
+ +
+ +

+ Controlling NetworkManager - nmcli +

+ +
+ +
+ +
+ +

+ Wi-Fi MAC addres Randomization +

+ +
+ +
+ +
+ +

+ Disk bandwidth utilization +

+ +
+ +
+ +
+ +

+ CentOS 8 Stream +

+ +
+ +
+ +
+ +

+ nftables load balancer +

+ +
+ +
+ +
+ +

+ Speed up apt installation or upgrade +

+ +
+ +
+ +
+ +

+ Life cycle of common Linux distributions +

+ +
+ +
+ +
+ +

+ Linux Kernel and GNU C Library version of common Linux distributions +

+ +
+ +
+ +
+ +

+ aria2 default configuration file +

+ +
+ +
+ +
+ +

+ MIPS Processors +

+ +
+ +
+ +
+ +

+ APT configuration and Preference +

+ +
+ +
+ +
+ +

+ Running a Container With a Non Root User +

+ +
+ +
+ +
+ +

+ How to set up a WebDAV share with Nginx +

+ +
+ +
+ +
+ +

+ Containers for development +

+ +
+ +
+ +
+ +

+ Synchronization of Linux clocks +

+ +
+ +
+ +
+ +

+ Zig Programming Language Quick Start +

+ +
+ +
+ +
+ +

+ SDXC card SD64G on Raspberry Pi +

+ +
+ +
+ +
+ +

+ Realtek RTL8152 Based USB Ethernet Adapter +

+ +
+ +
+ +
+ +

+ Multicast DNS (mDNS) +

+ +
+ +
+ +
+ +

+ WireGuard on Raspberry Pi +

+ +
+ +
+ +
+ +

+ USB to TTL - CH340 +

+ +
+ +
+ +
+ +

+ Realtek RTL8761B based Bluetooth adapter +

+ +
+ +
+ +
+ +

+ Ubuntu 20.04 arm64 on Raspberry Pi 3B+ +

+ +
+ +
+ +
+ +

+ Ubuntu 20.04 armhf on Raspberry Pi 3B+ +

+ +
+ +
+ +
+ +

+ Statically Linked Executable Hardening with PIE +

+ +
+ +
+ +
+ +

+ .NET on Linux +

+ +
+ +
+ +
+ +

+ Nested virtualization +

+ +
+ +
+ +
+ +

+ Linux Unified Key Setup +

+ +
+ +
+ +
+ +

+ Linux Home and End Keys +

+ +
+ +
+ +
+ +

+ Fused Multiply-Add (FMA) +

+ +
+ +
+ +
+ +

+ Compiling the Linux Kernel for WSL2 +

+ +
+ +
+ +
+ +

+ Console Based Gmail Client +

+ +
+ +
+ +
+ +

+ GTK User Configuration +

+ +
+ +
+ +
+ +

+ Run Linux GUI Programs With WSLg Through OCI Image +

+ +
+ +
+ +
+ +

+ Post-Quantum Cryptography in OpenPGP +

+ +
+ +
+ +
+ +

+ OpenSSH Login with GnuPG (OpenPGP) Keys +

+ +
+ +
+ +
+ +

+ Rust project promote the wasm32-wasip2 target to Tier 2 +

+ +
+ +
+ +
+ + + + + + + +
+ + IPv6 + + +
+ +

+ CMCC IPv6 +

+ +
+ +
+ +
+ + + +
+ + IPv4 + + +
+ +

+ IPv4 Multicast technology +

+ +
+ +
+ +
+ +
+ + RBAC + + +
+ +

+ RBAC principle +

+ +
+ +
+ +
+ +
+ + UML + + +
+ +

+ Diagram of UML and SysML +

+ +
+ +
+ +
+ + + + + +
+ + CQRS + + +
+ +

+ CQRS LDC +

+ +
+ +
+ +
+ +
+ + IDE + + +
+ +

+ Editor Config +

+ +
+ +
+ +
+ + + + + + + + + + + + + +
+ + MIPS + + +
+ +

+ MIPS Processors +

+ +
+ +
+ +
+ + + + + + + + + + + + + + + + + +
+ + Dart + + +
+ +

+ Dart programming language +

+ +
+ +
+ +
+ + + + + + + +
+
+ + + + + + +