2021/10/8

mender.io : dump content from *.mender

要從 mender file 中拿到安裝檔,script...,要用 dump command:
~$ mender-artifact dump --help
NAME:
   mender-artifact dump - Dump contents from Artifacts

USAGE:
   mender-artifact dump [command options] <Artifact>

DESCRIPTION:
   Dump various raw files from the Artifact. These can be used to create a new Artifact with the same components.

OPTIONS:
   --files value      Dump all included files in the first payload into given folder
   --meta-data value  Dump the contents of the meta-data field in the first payload into given folder
   --print-cmdline    Print the command line that can recreate the same Artifact with the components being dumped. 
                      If all the components are being dumped, a nearly identical Artifact can be created. 
                      Note that timestamps will cause the checksum of the Artifact to be different, 
                      and signatures can not be recreated this way. The command line will only use long option names.
   --print0-cmdline   Same as 'print-cmdline', except that the arguments are separated by a null character (0x00).
   --scripts value    Dump all included state scripts into given folder
   
上面help 中的value 是說你要 dump 到那一個目錄...

討論區文章的說明,mender 可以直接用 tar 解開。
實際測試,tar 解開的不包含 scripts 和 print-cmdline 的內容。
大概跟 --files 的輸出一樣。

所以要拿到 state_scripts ,還是要用 dump command


另外,做 delta update 時,會確認 base image 的 checksum 和 delta ota package 中的 base image 是不是一樣。
是用 sha256sum 來確認的。
sha256sum <your partition> 

2021/10/5

kernel console , buf length and sync async

是說.. 現在 kernel printk 都已經是 async 了。
但是要 force sync 的話,還是可以,用printk.synchronous = 1,加到 boot cmdline

printk log buffer length 也可以改,有兩種方法..
一個是改 kernel,一個是用 boot cmdline

CONFIG_LOG_BUF_SHIFT : 可以用 menuconfig 設定。

log_buf_len=65536 : 可以加在 boot cmdline

banana pi, console UART

主要是 banana pi 的 console uart pin 跟 raspberry pi 不一樣。
不是在 gpio 那兩排,而是在中間突出的一小塊。

bookmark: A Minimum Complete Tutorial of Linux ext4 File System

上面 e2fsprog 裡免的 debugfs :
# debugfs -R "ls -l" /dev/sda6
  2   40755 (2)   1001   1001    4096 17-Sep-2013 04:03 .
  2   40755 (2)   1001   1001    4096 17-Sep-2013 04:03 ..
 16  100644 (1)   1001   1001    9085 17-Sep-2013 04:03 avserver.conf
 17  100644 (1)   1001   1001    2177 17-Sep-2013 04:03 bash.bashrc
 26  100644 (1)   1001   1001     722 17-Sep-2013 04:03 crontab
還有 cat 的方法:
進入 debugfs,argument 是 ext4 的 image:
$ debugfs my.ext4
debugfs:
然後就可以在 debugfs 這個 prompt 下命令。
像 ls -l 或是 cat /etc/os-release...

repo forall .. variable name

repo forall 可以用的 變數,在 subcmds/forall.py 中有說明
# Environment

pwd is the project's working directory.  If the current client is
a mirror client, then pwd is the Git repository.

REPO_PROJECT is set to the unique name of the project.

REPO_PATH is the path relative the the root of the client.

REPO_REMOTE is the name of the remote system from the manifest.

REPO_LREV is the name of the revision from the manifest, translated
to a local tracking branch.  If you need to pass the manifest
revision to a locally executed git command, use REPO_LREV.

REPO_RREV is the name of the revision from the manifest, exactly
as written in the manifest.

REPO_COUNT is the total number of projects being iterated.

REPO_I is the current (1-based) iteration count. Can be used in
conjunction with REPO_COUNT to add a simple progress indicator to your
command.

REPO__* are any extra environment variables, specified by the
"annotation" element under any project element.  This can be useful
for differentiating trees based on user-specific criteria, or simply
annotating tree details.
test...
strong
em

2021/10/4

#define PKTLINK(skb)                    (((struct sk_buff*)(skb))->prev)
然後...
        /* queueing chains not allowed and no segmented SKB (Kernel-3.18.y) */
        ASSERT(!((PKTLINK(p) != NULL) && (PKTLINK(p) != p)));