2021/1/29

network, infer, computing .. GOPS GFLOPS

一般用來估算計算量(力),單位是 GFLOPS, GOPS.
  • FL : floating poinr
  • O : operation
  • PS : per second
然後 M: Meta,G : Giga, T: Tera。

一般 SOC 會用 network 的 infer rate 來標示自己的算力。
如果比較不同 SOC 時,除非剛好用一樣的 network。和 input size。
不然就要去找一下 network 的 GOPs...雖然同一個network 在不同 SOC 的實做會不一樣。但是至少有概念。
另外, input size 是等比算力?

這一篇,就是以 Inception V3 為例,不同 input 對應的 GOPS。
大概可以算是跟 input 面積等比。


另外,這一篇 有計算GOPS 的 code

2021/1/28

mender.io build and install client from sources


source code 的 Makefile, install :
  • build from source assign prefix=~/mymender
  • make install
  • copy all mymender to /
  • start service
go 版本要 1.13 以上。
如果 dist 的版本太舊。可以用官網的 tar 安裝。

make 前先..
export DESTDIR=/home/pi/inst
make 完,make install
go build -ldflags "-X github.com/mendersoftware/mender/conf.Version=7cb96ca"  
install -m 755 -d /home/pi/inst/usr/bin
install -m 755 mender /home/pi/inst/usr/bin/
install -m 755 -d /home/pi/inst/etc/mender
echo "artifact_name=unknown" > /home/pi/inst/etc/mender/artifact_info
install -m 755 -d /home/pi/inst/usr/share/mender
install -m 755 -d /home/pi/inst/usr/share/dbus-1/system.d
install -m 644 support/dbus/io.mender.AuthenticationManager.conf /home/pi/inst/usr/share/dbus-1/system.d/
install -m 755 -d /home/pi/inst/usr/share/doc/mender-client/examples
install -m 0644 support/demo.crt /home/pi/inst/usr/share/doc/mender-client/examples/
install -m 755 -d /home/pi/inst/usr/share/mender/identity
install -m 755 support/mender-device-identity /home/pi/inst/usr/share/mender/identity/
install -m 755 -d /home/pi/inst/usr/share/mender/inventory
install -m 755 support/mender-inventory-bootloader-integration support/mender-inventory-hostinfo support/mender-inventory-network support/mender-inventory-os support/mender-inventory-provides support/mender-inventory-rootfs-type support/mender-inventory-update-modules /home/pi/inst/usr/share/mender/inventory/
install -m 755 -d /home/pi/inst/usr/share/mender/inventory
install -m 755 support/mender-inventory-geo /home/pi/inst/usr/share/mender/inventory/
install -m 755 -d /home/pi/inst/usr/share/mender/modules/v3
install -m 755 support/modules/deb support/modules/docker support/modules/directory support/modules/single-file support/modules/rpm support/modules/script /home/pi/inst/usr/share/mender/modules/v3/
install -m 755 -d /home/pi/inst/lib/systemd/system
install -m 0644 support/mender-client.service /home/pi/inst/lib/systemd/system/
看一下 inst..
├── etc
│   └── mender
│       └── artifact_info
├── lib
│   └── systemd
│       └── system
│           └── mender-client.service
└── usr
    ├── bin
    │   └── mender
    └── share
        ├── dbus-1
        │   └── system.d
        │       └── io.mender.AuthenticationManager.conf
        ├── doc
        │   └── mender-client
        │       └── examples
        │           └── demo.crt
        └── mender
            ├── identity
            │   └── mender-device-identity
            ├── inventory
            │   ├── mender-inventory-bootloader-integration
            │   ├── mender-inventory-geo
            │   ├── mender-inventory-hostinfo
            │   ├── mender-inventory-network
            │   ├── mender-inventory-os
            │   ├── mender-inventory-provides
            │   ├── mender-inventory-rootfs-type
            │   └── mender-inventory-update-modules
            └── modules
                └── v3
                    ├── deb
                    ├── directory
                    ├── docker
                    ├── rpm
                    ├── script
                    └── single-file

18 directories, 20 files
然後舊可以把 inst 下對應的 folder copy 到系統的 ../
debian 的 /lib 是 link 到 /usr/lib,所以要 copy 到 /usr

然後參考 demo server 的 script,手動:
$ sudo mender setup --device-type "raspberrypi3" --quiet --demo --server-ip 192.168.144.179
生成的 /etc/mender/mender.conf
{
    "ClientProtocol": "https",
    "ArtifactVerifyKey": "",
    "HttpsClient": {
        "Certificate": "",
        "Key": "",
        "SSLEngine": ""
    },
    "Security": {
        "AuthPrivateKey": "",
        "SSLEngine": ""
    },
    "RootfsPartA": "",
    "RootfsPartB": "",
    "DeviceTypeFile": "/var/lib/mender/device_type",
    "DBus": {
        "Enabled": true
    },
    "UpdatePollIntervalSeconds": 5,
    "InventoryPollIntervalSeconds": 5,
    "SkipVerify": false,
    "RetryPollIntervalSeconds": 30,
    "StateScriptTimeoutSeconds": 0,
    "StateScriptRetryTimeoutSeconds": 0,
    "StateScriptRetryIntervalSeconds": 0,
    "ModuleTimeoutSeconds": 0,
    "ServerCertificate": "/usr/share/doc/mender-client/examples/demo.crt",
    "ServerURL": "",
    "UpdateLogPath": "",
    "TenantToken": "",
    "Servers": [
        {
            "ServerURL": "https://docker.mender.io"
        }
    ]
}
然後 /etc/hosts 多了一行:
192.168.144.179 docker.mender.io s3.docker.mender.io
重新開機後...
~ $ sudo systemctl status mender-client
● mender-client.service - Mender OTA update service
   Loaded: loaded (/lib/systemd/system/mender-client.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
所以手動啟動...systemctl start mender-client
之後,在 local 的 mender server 上就可以看到 pending device 了..

同樣的 方法在 ubuntu 上做,結果 fail.. journalctl -r
Jan 29 10:05:16 ubuntu mender[2068]: time="2021-01-29T10:05:16Z" level=error msg="Authorize failed: transient error: authorization request failed: transient error: authorization request failed: Unknown url.Error type: dial tcp 192.168.144.79:443: connect: connection refused"
Jan 29 10:05:16 ubuntu mender[2068]: time="2021-01-29T10:05:16Z" level=error msg="Failure occurred while executing authorization request: Method: Post, URL: https://docker.mender.io/api/devices/v1/authentication/auth_requests"

在 debian 上出現 self-sign error,所以修改一下
~ $ curl -k -X POST https://docker.mender.io/api/devices/v1/authentication/auth_requests
{"error":"failed to decode auth request: unexpected end of JSON input","request_id":"f315ea65-8df2-4f8f-8d8a-67bca6947014"}
所以跟 distribution 有關?

用 nmap 檢查...
pi@raspberrypi:~ $ nmap docker.mender.io
Starting Nmap 7.70 ( https://nmap.org ) at 2021-01-29 10:32 GMT
Nmap scan report for docker.mender.io (192.168.144.179)
Host is up (0.0014s latency).
Not shown: 992 closed ports
PORT     STATE SERVICE
22/tcp   open  ssh
111/tcp  open  rpcbind
139/tcp  open  netbios-ssn
443/tcp  open  https
445/tcp  open  microsoft-ds
2049/tcp open  nfs
8084/tcp open  unknown
9000/tcp open  cslistener

Nmap done: 1 IP address (1 host up) scanned in 0.36 seconds

星期一 gateway pc 重開機後,手動build, install 的 rpi3 ubuntu arm64 可以正確註冊到 demo server 上了 (不是 gateway 上的)。
demo server 的 nmap 正確list port 443

所以上面的build, install 程序應該 OK

恢復到 不 enable dbus lzma
make TAGS=nolzma nodbus

實際在 evb 上安裝,發現只需要..
* mender : 執行檔
* demo.crt : cert file
* mender-device-identity : script to get board mac address, name and system property
* artifact_info : info file
* mender-client.service : systemd service config file
安裝完 run mender setup .. 就會產生 mender.conf. 和 修改 /etc/hosts...

mender 會 call 其他 sys tool,所以systemd 的 service conf 要能 access 到 system tool (/bin ?)
所以大概是..
[Unit]
Description=Mender OTA update service
After=network.target

[Service]
Type=idle
User=root
Group=root
#ExecStart=/usr/bin/mender daemon
ExecStart=/bin/bash -c "PATH=/bin: exec /usr/bin/mender daemon"

[Install]
WantedBy=multi-user.target
安裝在 /usr/lib/system/system/ 下的 mender-client.serivce,手動 systemctl start 成功後。就可以用 systemctl enable mender-client 把他設定為系統開機就啟動。
-- 會 create link 到 /etc/systemd/system/multi-usr.targt

mender.io getting start, raspberry pi client install script

get.mender.io 得到的是 index.html,但是script 內容說明是install-mender.sh

就是把 https://downloads.mender.io/repos/debian 加到 source.list 中。
然後 apt install mender-client 跟 mender-connect

因為是用 deb 安裝...
apt-get download mender-client
dpkg-deb -R mender-client_2.5.0-1_armhf.deb mender-client
然後去 mender-client 看
.
├── DEBIAN
│   ├── conffiles
│   ├── control
│   ├── md5sums
│   ├── postinst
│   ├── postrm
│   └── prerm
├── etc
│   └── mender
│       └── artifact_info
├── lib
│   └── systemd
│       └── system
│           └── mender-client.service
└── usr
    ├── bin
    │   ├── directory-artifact-gen
    │   ├── docker-artifact-gen
    │   ├── mender
    │   └── single-file-artifact-gen
    └── share
        ├── dbus-1
        │   └── system.d
        │       └── io.mender.AuthenticationManager.conf
        ├── doc
        │   ├── mender
        │   └── mender-client
        │       ├── changelog.Debian.gz
        │       ├── copyright
        │       └── examples
        │           └── demo.crt
        └── mender
            ├── identity
            │   └── mender-device-identity
            ├── inventory
            │   ├── mender-inventory-bootloader-integration
            │   ├── mender-inventory-geo
            │   ├── mender-inventory-hostinfo
            │   ├── mender-inventory-network
            │   ├── mender-inventory-os
            │   ├── mender-inventory-provides
            │   ├── mender-inventory-rootfs-type
            │   └── mender-inventory-update-modules
            └── modules
                └── v3
                    ├── deb
                    ├── directory
                    ├── docker
                    ├── rpm
                    ├── script
                    └── single-file

20 directories, 31 files

DEBIAN 目錄下就是一些 安裝/移除 時 run 的 script (在 copy /rm 完 file 之後)
postint:
if [ ! -f /etc/mender/mender.conf ]; then

    # For non interactive installs, reproduce the default production
    # configuration with a dummy device type and tenant token.
    DEVICE_TYPE=${DEVICE_TYPE:=$(cat /etc/hostname)}
    if [ "$DEBIAN_FRONTEND" == "noninteractive" ]; then
        mender setup \
            --quiet \
            --device-type "${DEVICE_TYPE}" \
            --demo=false \
            --hosted-mender \
            --tenant-token "Paste your Hosted Mender token here" \
            --update-poll 1800 \
            --inventory-poll 28800 \
            --retry-poll 300

    # Run the interactive setup wizard
    else
        mender setup
    fi

fi
就是產生一個標準的 /etc/mender/mender.conf,.. 所以 demo 版的 後來要重新 run 一次,設定為 demo mode.
還有有關 service 新增與啟動..
# Automatically added by dh_installinit
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ]; then
        if [ -x "/etc/init.d/mender-client" ]; then
                update-rc.d mender-client defaults >/dev/null
                if [ -n "$2" ]; then
                        _dh_action=restart
                else
                        _dh_action=start
                fi
                invoke-rc.d mender-client $_dh_action || exit $?
        fi
fi
# End automatically added section
# Automatically added by dh_systemd_start
if [ -d /run/systemd/system ]; then
        systemctl --system daemon-reload >/dev/null || true
        if [ -n "$2" ]; then
                _dh_action=try-restart
        else
                _dh_action=start
        fi
        deb-systemd-invoke $_dh_action mender-client.service >/dev/null || true
fi

2021/1/26

reading notes on mender.io

client 可以config 成兩種 mode:
  • managed: 以daemon 的方式run 在背景,定時向 server 詢問是否需要更新
  • standalone: 人工方式,不連網,也可以用 usb, sd card 或 command line 啟動更新
HUB (community) 有一篇:mender from scratch,有說明 cross build 的方法。
reference 到 1.7 版的文件
查 2.6 (最新)版,並沒有這一個文件。
最新的文件說,cross compile 的步驟寫在 github project 的 README,其中 cross-compile 的部份。

mender.io : local server. demo mode

follow 這一篇,apt install docker docker-compose,
然後就是頁面的 package,clone, dmeo up 之後,就會開始拉 image,docker 啟動。
beaver:~/integration-2.6.0$ ./demo up
Pulling mender-gui                    ... done
Pulling mender-mongo                  ... done
Pulling mender-useradm                ... done
Pulling mender-inventory              ... done
Pulling mender-workflows-worker       ... done
Pulling mender-deployments            ... done
Pulling mender-workflows-server       ... done
Pulling mender-device-auth            ... done
Pulling mender-create-artifact-worker ... done
Pulling mender-api-gateway            ... done
Starting the Mender demo environment...
Creating network "integration260_mender" with the default driver
Pulling mender-nats (nats:2.1.9-alpine3.12)...
2.1.9-alpine3.12: Pulling from library/nats
801bfaa63ef2: Already exists
ac4f83c9bcde: Pull complete
57817554b320: Pull complete
0da7ddd1cbb1: Pull complete
Digest: sha256:6aeb085e155fdf6e26686f84b6bbda85decabb26618cf9a4a9a6e60fb2ddedd4
Status: Downloaded newer image for nats:2.1.9-alpine3.12
Pulling minio (minio/minio:RELEASE.2018-09-25T21-34-43Z)...
RELEASE.2018-09-25T21-34-43Z: Pulling from minio/minio
c67f3896b22c: Pull complete
28537c0b7408: Pull complete
57b9c24c4fa7: Pull complete
Digest: sha256:635d93e85eaf126ac855ed1287b0eedaf0c041e63b010eeb1fc82daada9bdcb0
Status: Downloaded newer image for minio/minio:RELEASE.2018-09-25T21-34-43Z
Pulling storage-proxy (openresty/openresty:1.13.6.2-0-alpine)...
1.13.6.2-0-alpine: Pulling from openresty/openresty
ff3a5c916c92: Already exists
ede0a2a1012b: Already exists
0e0a11843023: Already exists
246b2c6f4992: Already exists
Digest: sha256:23ff32a1e7d5a10824ab44b24a0daf86c2df1426defe8b162d8376079a548bf2
Status: Downloaded newer image for openresty/openresty:1.13.6.2-0-alpine
Pulling mender-deviceconnect (mendersoftware/deviceconnect:mender-2.6.0)...
mender-2.6.0: Pulling from mendersoftware/deviceconnect
801bfaa63ef2: Already exists
25798b78a38d: Already exists
0b338ec2571f: Pull complete
75ebc69b42cb: Pull complete
e71672d9a5af: Pull complete
Digest: sha256:42bfbfe567dfee285be895df2c8eba0319b7fedd0fd717831ecee5ccb010595e
Status: Downloaded newer image for mendersoftware/deviceconnect:mender-2.6.0
Creating integration260_mender-mongo_1 ... 
Creating integration260_mender-gui_1 ... 
Creating integration260_minio_1 ... 
Creating integration260_mender-nats_1 ... 
Creating integration260_mender-mongo_1
Creating integration260_mender-gui_1
Creating integration260_minio_1
Creating integration260_mender-mongo_1 ... done
Creating integration260_mender-create-artifact-worker_1 ... 
Creating integration260_mender-useradm_1 ... 
Creating integration260_mender-workflows-worker_1 ... 
Creating integration260_mender-inventory_1 ... 
Creating integration260_mender-workflows-server_1 ... 
Creating integration260_mender-create-artifact-worker_1
Creating integration260_mender-useradm_1
Creating integration260_mender-workflows-worker_1
Creating integration260_mender-inventory_1
Creating integration260_mender-nats_1 ... done
Creating integration260_mender-deviceconnect_1 ... 
Creating integration260_mender-workflows-server_1 ... done
Creating integration260_mender-device-auth_1 ... 
Creating integration260_mender-device-auth_1 ... done
Creating integration260_storage-proxy_1 ... 
Creating integration260_storage-proxy_1 ... done
Creating integration260_mender-deployments_1 ... 
Creating integration260_mender-deployments_1 ... done
Creating integration260_mender-api-gateway_1 ... 
Creating integration260_mender-api-gateway_1 ... done
It does not seem the useradm service is up and running yet. Retrying...
Creating a new user...
****************************************

Username: mender-demo@example.com
Login password: A2A502B25725

****************************************
Please keep the password available, it will not be cached by the login script.
Mender demo server ready and running in the background. Copy credentials above and log in at https://localhost
Press Enter to show the logs.
Press Ctrl-C to stop the backend and quit.
這個 username password 會跟著這個 image,不刪除,每次 ./demo up,都會啟動鄉同的 container image。用一樣的 username password。而且下次不會再show...

https://localhost, 舊可以看到 mender.io 一樣的 server login 畫面。

看一下啟動的 container 有..
beaver:~$ docker ps
CONTAINER ID   IMAGE                                                COMMAND                  CREATED         STATUS                   PORTS                          NAMES
396265c9b707   mendersoftware/api-gateway:mender-2.6.0              "/entrypoint.sh"         2 minutes ago   Up 2 minutes             80/tcp, 0.0.0.0:443->443/tcp   integration260_mender-api-gateway_1
804700b88d66   mendersoftware/deployments:mender-2.6.0              "/entrypoint.sh --co…"   2 minutes ago   Up 2 minutes             8080/tcp                       integration260_mender-deployments_1
6c6d3951fc42   openresty/openresty:1.13.6.2-0-alpine                "/usr/local/openrest…"   2 minutes ago   Up 2 minutes             0.0.0.0:9000->9000/tcp         integration260_storage-proxy_1
d6d575f6f36d   mendersoftware/deviceauth:mender-2.6.0               "/usr/bin/deviceauth…"   3 minutes ago   Up 3 minutes             8080/tcp                       integration260_mender-device-auth_1
cb6f1e5c0a57   mendersoftware/deviceconnect:mender-2.6.0            "/usr/bin/deviceconn…"   3 minutes ago   Up 3 minutes             8080/tcp                       integration260_mender-deviceconnect_1
23603e599242   mendersoftware/workflows:mender-2.6.0                "/usr/bin/workflows …"   3 minutes ago   Up 3 minutes             8080/tcp                       integration260_mender-workflows-server_1
2a83ec69a76b   mendersoftware/inventory:mender-2.6.0                "/usr/bin/inventory …"   3 minutes ago   Up 3 minutes             8080/tcp                       integration260_mender-inventory_1
da910c62cc8f   mendersoftware/workflows-worker:mender-2.6.0         "/usr/bin/workflows …"   3 minutes ago   Up 3 minutes                                            integration260_mender-workflows-worker_1
c0fd411536f8   mendersoftware/useradm:mender-2.6.0                  "/usr/bin/useradm --…"   3 minutes ago   Up 3 minutes             8080/tcp                       integration260_mender-useradm_1
e394d4ce5400   mendersoftware/create-artifact-worker:mender-2.6.0   "/usr/bin/workflows …"   3 minutes ago   Up 3 minutes             8080/tcp                       integration260_mender-create-artifact-worker_1
c59304ee734d   nats:2.1.9-alpine3.12                                "docker-entrypoint.s…"   3 minutes ago   Up 3 minutes             4222/tcp, 6222/tcp, 8222/tcp   integration260_mender-nats_1
bfbbc8b40e74   mendersoftware/gui:mender-2.6.0                      "/entrypoint.sh nginx"   3 minutes ago   Up 3 minutes (healthy)   80/tcp, 8080/tcp               integration260_mender-gui_1
b93c1579ac59   mongo:4.4                                            "docker-entrypoint.s…"   3 minutes ago   Up 3 minutes             27017/tcp                      integration260_mender-mongo_1
3008f0926911   minio/minio:RELEASE.2018-09-25T21-34-43Z             "/usr/bin/docker-ent…"   3 minutes ago   Up 3 minutes (healthy)   9000/tcp                       integration260_minio_1
Ctrl-C 會停止這個 container,但是下次開機會自動開起來。
用 ./demo down 會 stop and remove container,但是image 部會刪。
Username: mender-demo@example.com
Login password: 358B822BDA78

0226: 5D9048D7091B

0303: 3D33B3E6B036

2021/1/21

go ...

ref: 原來現在 (1.15) 有放prebuild 的 armv8 (64) 的 binary
所以在 pi ubuntu (64) 上,也可以 依照 x86 的方式,download, untar 後 set path 就完成了。
-- 當然,也可以用 apt install golang

raspios 目前 21-01-11 是 debian buster,go 版本是1.11
pi 都是 32bit,所以要download ARMv6l 的 tar
sudo tar -C  /usr/local -xzf go1.15.8.linux-armv6l.tar.gz
修改 ~/.profile,加上
PATH=$PATH:/usr/local/go/bin

sudo 找不到 go command,參考這裡,這是因為 sudo 的 path 參考的是 /etc/sudoers。

2021/1/20

Alsa : list all device, name and description

ref: 就是.. 在使用 alsalib, opendevice 時,要找到要用的 device, 利用 snd library ,可以enumerate 所有 alsa
為了防止網站消失,把他的 code copy 下來...
#include <stdio.h>
#include <limits.h>
#include <stdlib.h>
#include <unistd.h>
#include <alsa/asoundlib.h>
void listdev(char *devname)
{
    char** hints;
    int    err;
    char** n;
    char*  name;
    char*  desc;
    char*  ioid;
    /* Enumerate sound devices */
    err = snd_device_name_hint(-1, devname, (void***)&hints);
    if (err != 0) {
        fprintf(stderr, "*** Cannot get device names\n");
        exit(1);
    }
    n = hints;
    while (*n != NULL) {
        name = snd_device_name_get_hint(*n, "NAME");
        desc = snd_device_name_get_hint(*n, "DESC");
        ioid = snd_device_name_get_hint(*n, "IOID");
        printf("Name of device: %s\n", name);
        printf("Description of device: %s\n", desc);
        printf("I/O type of device: %s\n", ioid);
        printf("\n");
        if (name && strcmp("null", name)) free(name);
        if (desc && strcmp("null", desc)) free(desc);
        if (ioid && strcmp("null", ioid)) free(ioid);
        n++;
    }
    //Free hint buffer too
    snd_device_name_free_hint((void**)hints);
}
int main(void)
{
    printf("PCM devices:\n");
    printf("\n");
    listdev("pcm");
    printf("MIDI devices:\n");
    printf("\n");
    listdev("rawmidi");
    return 0;
}
make 的時候加上 -lasound 來 link alsa library
 sudo apt-get install libasound2-dev

2021/1/14

bookmark : udev automount

一般用 udev 的 removeable media auto mount script 跟 udev rule

都是 script...

README 就說的很清楚,直接 copy 過來..


Auto mount removable media devices by means of udev rules.

This is intended for simple systems that don't want or can't run the udisks2 daemon (which is designed for GNOME/KDE desktop environments and at the time of this writting is frustrating to set up from a bare commandline).

This combines the previous udev rules I was using in my xdg_config repository with some structure and ideas taken from tylorchu's usb-automount.

Every device that is inserted and isn't already configured in /etc/fstab will be mounted by media-automount. This includes not only usb devices but also card readers and other media with a /dev/sd* device.

If there are devices you don't want to automount neither at boot nor with media-automount, you can add them in /etc/fstab with the option 'noauto'.

The mount options might differ to the filesystem type for the device plugged in. E.g. vFAT and NTFS devices will be mounted with the "flush" option to try to prevent damage on accidental removals of the device with unclean umounts. Also whenever ntfs-3g is available, it will be used to mount ntfs devices.

The mount directory will appear in /media/ under a name with pattern: "LABEL_OF_THE_FS.FS_TYPE"

Due to changes in udev (long running processes are killed), it's necessary to use systemd for spawning a mounting service.
The script will also use the 'logger' tool to write to the system log.

2021/1/12

try exfat-nofuse

因為 kernel 是 4.4 (only),所以不能用最新的 buildin exfat driver。
一些 exfat 都是 FUSE,可能- 有效能問題。
所以 try 一下 driver 的 support。
有幾個... 第一個的 README 有詳細說明放到 kernel source 中 build 的 instruction。
所以試試看..

遵照說明放到 kernel source 的 fs 下。修改 Kconfig, Makefile。
然後make menuconfig,check exfat (M) 後 rebuild kernel..
燒錄到 target board 上。

準備好一個 sd card, format 成 exfat:
mkfs.exfar /dev/sdb1
插到 target board 上,mount 起來..
mount /dev/mmcblk1p1 /sdcard
...
...
/dev/mmcblk1p1 on /sdcard type exfat (rw,relatime,fmask=0022,dmask=0022,iocharset=utf8,namecase=0,errors=remount-ro)
...
# lsmod
Module                  Size  Used by
exfat                 139264  1
...
然後dd 看...
# dd if=/dev/zero of=/sdcard/zero bs=1000000 count=500
500+0 records in
500+0 records out
500000000 bytes (476.8MB) copied, 105.002533 seconds, 4.5MB/s

2021/1/10

這真的是值得紀錄的事...

twittet跟 fb 把 (前?)總統的帳號停了,總統就改到parler...>br> 然後 google 跟 apple 的 store 就把 parler 下架。但是已經下載的人還是可以繼續用。指揮parler也出 web版,不用下載app。
然後 amazon 就停止parler使用aws的服務...
猜parler改用自己的server,然後營運商停止他的dna服務...

原來網路還是有統治階級..

然後,原來這種事以前舊發生過了,是 Gab...
Gab 一樣,出 web 版,然後 Godaddy 不給他 host dns
一直到一家 Epik dns hoster 幫他..

然後,paypall 停止support Epik ...(這個不知道有沒有跟 gab 有官...)

2021/1/7

some wifi command

wpa_cli,還有 broadcom 專屬的 wl

wpa_cli 要能正常執行,wpa_supplicant 必須要先 run 起來,as daemon
然後直接執行 wpa_cli 的會,會進入 interactove mode (有 prompt >)

看一下wifi chip 有幾個 interface..
> interface
Available interfaces:
bcm0
wlan0
然後用 interface 來選目賢要連接的是...
> interface wlan0
connected to interface 'wlan0.
看狀態:
> status
wpa_state=INACTIVE
address=a4:04:50:da:62:aa
uuid=67b7a012-8776-5d32-9e01-ec6d39191dee
上面的例子,wlan0 是 STA mode
下面改用 bcm0 (AP mode) 來看
> interface bcm0
Connected to interface 'bcm0.
> status
bssid=a6:04:50:da:62:11
freq=2462
ssid=FS-WiFi-50da6211
id=0
mode=AP
pairwise_cipher=UNKNOWN
group_cipher=TKIP
key_mgmt=WPA-PSK
wpa_state=COMPLETED
ip_address=192.168.42.1
address=a6:04:50:da:62:44
uuid=67b7a012-8776-5d32-9e01-ec6d39191daa
> list_networks
network id / ssid / bssid / flags
0	FS-WiFi-50da6211	any	[CURRENT]
> disable_network 0
OK
> status
wpa_state=DISCONNECTED
ip_address=192.168.42.1
address=b2:04:50:da:62:11
uuid=99b7a012-8776-5d32-9e01-ec6d39191dff
> enable_network 0
OK
> status
bssid=a6:04:50:da:62:11
freq=2462
ssid=FS-WiFi-50da6211
id=0
mode=AP
pairwise_cipher=UNKNOWN
group_cipher=TKIP
key_mgmt=WPA-PSK
wpa_state=COMPLETED
ip_address=192.168.42.1
address=a6:04:50:da:62:44
uuid=67b7a012-8776-5d32-9e01-ec6d39191daa
> disable_network 0
OK
scan 的結果會是...
bssid frequency signal level flags ssid
只需要指定 bssid 或是 ssid 就可以連線。
有些時候很多 AP 會使用同一個 ssid,這時候舊可以指定 bssid 來連線到指定的 ap
> set_network 0 bssid xx:xx:xx:xx:xx:xx
設定 bssid 的時候,不必像 ssid 一樣,要用 " " 包起來。