【每周学习摘要08(23/11/11-23/11/17)】

软件

安装Latex于Ubuntu

source

探究为什么暑假七月份在Ubuntu23.04上制作根文件系统不能被内核识别

内核提示 e2fsck has unsupported feature(s): FEATURE_C12
这是因为ubuntu23.04的e2fsck添加了个新的特性orphan_file(就是FEATURE_C12,只不过老的内核不认识这个叫orphan_file)并且默认开启了
但是好像在ubuntu23.10中不会默认开启,具体细节可以看/etc/mke2fs.conf
source1

According to release notes, the feature added in version 1.47.0 is orphan_file. And it was also added to the list of default features for e2fsck.
So if a filesystem was created with e2fsck 1.47.0 then it will have this feature enabled by default.

解决方法

tune2fs -O ^orphan_file /dev/mydevice
e2fsck -f /dev/mydevice

第二个命令是为了移除相关inode,-O是指定feature, ^相当于not
source2
source3
source4
tune2fs -l 查看文件系统属性

 tune2fs -l /dev/sda2 

V3s录音,以及之后需要的语音识别

V3s codec实现了录音驱动,但是默认dts没开,需要手动设置成okay.
source
之后可以用alsa的api采集pcm数据,然后通过阿里云的语音识别api(他们有C++ SDK)
智能语音交互-阿里云

关于ChatGPT集成可参考树莓派Linux实现ChatGPT语音交互(语音识别,TTS)
到时候比如人物角色识别可以用到阿里云的热词功能热词

车万云音乐

接口

帮助:音乐资料API
目前工作内容:

【分类组】无蛋黄 1:17:34
我想要一个网易云歌单与wiki曲库定期进行同步的小工具
【分类组】无蛋黄 1:18:57
还要一个在wiki曲目列表上播放网易云相关曲目链接的小播放按钮
【分类组】无蛋黄 1:19:15
之前狮子做过一个,现在不知道怎么用了

仓库地址
车万云

MacOS

处理未签名应用无法执行的问题
cant-execute-binary-on-macos-catalina
mac_procs_unsigned.html
如果binary叫foo

spctl --add foo
xattr -d com.apple.quarantine foo

嵌入式

低成本WCH DapLink方案

WCH Link,采用51内核CH549G方案
简介:成本4元的wchlink/daplink,使用ch549g

Computer Vision

关于学习的一些指导
source
作为目前在华为美国研究所实习的博士生。拿计算机视觉领域,重要的不是看,而是 做 和 写。跟进自己领域的文章,重点是看一些自己领域的活跃的大牛的文章(重点是开源代码的文章),而且要去看代码和跑代码。看其他顶会的文章,不能说没用,但是,效率极低,他们不会开源代码、不会告诉你细节,可能你看的例如CVPR文章是编的。新手入门大概就看本领域SOTA 模型 且带代码的跑出来,3-4篇搞定即可,顶会实验对照也是找3-4个模型比较,搞定后才知道这些模型的不足。再去看最前沿的技术,比如目前的语言模型 和 diffusion ,同样实践很重要,看如何加入自己领域的模型做改进。写文章更重要,很多人做一堆实验却不想写,白白浪费时间和浪费顶会投稿的机会(投就有25%到50%的录取机会,录取率看分支领域,你投稿时即使被拒,审稿人都会写一堆审稿意见的,你改进后,投下一个会议的命中率会大大提升)。

Ubuntu KDE

解决单击打开Dolphin文件的问题

System SettingsWorkspace Behavior中的Clicking files or folders改成Selects them
source

解决sddm开屏键盘问题

vim /etc/sddm.conf

输入

InputMethod=

source

miniconda3 无法被zsh找到安装的文件

.zshrc中添加~/miniconda3/bin路径
source

sddm 添加主题

我个人喜欢breeze,比较好看
先安装

sudo apt install sddm-theme-maya
sddm-greeter --test-mode --theme /usr/share/sddm/themes/maya
sudo apt install sddm-theme-breeze
sddm-greeter --test-mode --theme /usr/share/sddm/themes/breeze

一个是测试一个是安装
然后在/etc/sddm.conf中添加

[Theme]
Current=breeze

即可

【每周学习摘要06(23/10/27-23/11/10)】

Allegro/PCB

调整历史编辑的buffer大小

source [OrCAD PCB] Undo history constantly disappears
source2 Only 100 undo-levels / 500MB for undo? Any way to increase that further?
搜索Undo_depth设置并将其设置为100,将max_undo_memory设置成500
"Specify the maximum memory (in MB) for storing undo history. Default is 20 MegaBytes. Range is 0 to 500."

"Specify the maximum number of commands for Undo history. More undo history takes more memory. Default is 10 commands. Range is 0 to 100 commands. The actual number of commands in the undo buffer is dynamically determined based upon this value and the undo memory consumed to undo each command, the total of which must not exceed max_undo_memory."

关于全志H3双DDR T型走线

首先,我是菜鸟,默认线宽4mil(太粗了走起来要去世,或者只能牺牲线距,这样综合起来还不如线宽4mil,然后减少串扰,因为同样是4mil,Yuzuki大佬能跑到DDR3 1866,也就是936MHz稳定24小时source,然而如果严格按照阻抗线宽只能到336Mhz CLK)
先拉通全部,先拉SDQ/SDQM/SDQS(差分信号)
再等长T到DDR(20mil),然后再等长Soc到T(30mil,ODTx/CSx/CKEx;600mil Other CMD/Address)
最后布电源,放置电容
具体请参考RK3568的PCB Layout手册(这是通用的)

代办:改天画一画六层板的单DDR,或者四层板TDDR

电控

STM32F334无法用OpenOCD0.12.0烧录

提示错误

** Programming Started **
Info : device id = 0x10016438
Info : flash size = 64 KiB
Warn : Adding extra erase range, 0x08005ebc .. 0x08005fff
Error: error writing to flash at address 0x08000000 at offset 0x00000000
embedded:startup.tcl:1467: Error: ** Programming Failed **
in procedure 'program'
in procedure 'program_error' called at file "embedded:startup.tcl", line 1532
at file "embedded:startup.tcl", line 1467

解决方法:切换OpenOCD版本为0.11或者0.10

软件

VM Ware 虚拟机在windows11下卡顿

用管理员权限运行VMWare Workstation

How to install multiple GCC versions under Ubuntu

gcc in ppa:ubuntu-toolchain-r/rest

source
first add ppa of host toolchains

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update

Then you can install gcc-7 for example

sudo apt-get install gcc-7
sudo apt-get install g++-7

also you can install gcc-8,gcc-9
After that, use update-alternatives to manage different gcc versions

sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 130
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 130

after that, use sudo update-alternatives --config gcc to switch between gcc versions
for example,

➜  u-boot-v2020.04-rc1 sudo update-alternatives --config gcc
There are 7 choices for the alternative gcc (providing /usr/bin/gcc).

  Selection    Path              Priority   Status
------------------------------------------------------------
  0            /usr/bin/gcc-13    130       auto mode
  1            /usr/bin/gcc-12    100       manual mode
  2            /usr/bin/gcc-13    130       manual mode
  3            /usr/bin/gcc-4.8   48        manual mode
* 4            /usr/bin/gcc-6     60        manual mode
  5            /usr/bin/gcc-7     70        manual mode
  6            /usr/bin/gcc-8     80        manual mode
  7            /usr/bin/gcc-9     90        manual mode

Press <enter> to keep the current choice[*], or type selection number: 4 
➜  u-boot-v2020.04-rc1 gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/6/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 6.5.0-2ubuntu1~18.04' --with-bugurl=file:///usr/share/doc/gcc-6/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++ --prefix=/usr --with-as=/usr/bin/x86_64-linux-gnu-as --with-ld=/usr/bin/x86_64-linux-gnu-ld --program-suffix=-6 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 6.5.0 20181026 (Ubuntu 6.5.0-2ubuntu1~18.04)

Then you can use an old gcc version to compile some old codebases(e.g. u-boot-v2020.04), which may have errors like

/usr/bin/ld: scripts/dtc/dtc-parser.tab.o:(.bss+0x10): multiple definition of `yylloc'; scripts/dtc/dtc-lexer.lex.o:(.bss+0x0): first defined here

I have tested gcc version 6,7,8,9 compatible with u-boot-v2020-04(i.e. the version used in Allwinner A33)

very old gcc

As for very old gcc versions, you can install them manually by downloading each deb package and install them using apt install ./*.deb

gcc-4.8

source

wget http://mirrors.aliyun.com/ubuntu/pool/universe/g/gcc-4.8/g++-4.8_4.8.5-4ubuntu8_amd64.deb
wget http://mirrors.aliyun.com/ubuntu/pool/universe/g/gcc-4.8/libstdc++-4.8-dev_4.8.5-4ubuntu8_amd64.deb 
wget http://mirrors.aliyun.com/ubuntu/pool/universe/g/gcc-4.8/gcc-4.8-base_4.8.5-4ubuntu8_amd64.deb 
wget http://mirrors.aliyun.com/ubuntu/pool/universe/g/gcc-4.8/gcc-4.8_4.8.5-4ubuntu8_amd64.deb
wget http://mirrors.aliyun.com/ubuntu/pool/universe/g/gcc-4.8/libgcc-4.8-dev_4.8.5-4ubuntu8_amd64.deb
wget http://mirrors.aliyun.com/ubuntu/pool/universe/g/gcc-4.8/cpp-4.8_4.8.5-4ubuntu8_amd64.deb
wget http://mirrors.aliyun.com/ubuntu/pool/universe/g/gcc-4.8/libasan0_4.8.5-4ubuntu8_amd64.deb
gcc-6
wget http://mirrors.aliyun.com/ubuntu/pool/universe/g/gcc-6/g++-6_6.5.0-2ubuntu1~18.04_amd64.deb 
wget http://mirrors.aliyun.com/ubuntu/pool/universe/g/gcc-6/libstdc++-6-dev_6.5.0-2ubuntu1~18.04_amd64.deb 
wget http://mirrors.aliyun.com/ubuntu/pool/universe/g/gcc-6/gcc-6-base_6.5.0-2ubuntu1~18.04_amd64.deb
wget http://mirrors.aliyun.com/ubuntu/pool/universe/g/gcc-6/gcc-6_6.5.0-2ubuntu1~18.04_amd64.deb
wget http://mirrors.aliyun.com/ubuntu/pool/universe/g/gcc-6/libgcc-6-dev_6.5.0-2ubuntu1~18.04_amd64.deb
wget http://mirrors.aliyun.com/ubuntu/pool/universe/g/gcc-6/cpp-6_6.5.0-2ubuntu1~18.04_amd64.deb
wget http://mirrors.aliyun.com/ubuntu/pool/universe/g/gcc-6/libasan3_6.5.0-2ubuntu1~18.04_amd64.deb
wget https://mirrors.aliyun.com/oldubuntu-releases/ubuntu/pool/main/i/isl/libisl19_0.20-2_amd64.deb

后来发现上述方法,不是很好,要一个一个自己找包

第二个办法:
我想通过将apt的source改成zesty(ubuntu16)来下载gcc-6的deb系统包(省的自己一个一个下载)
通过将/etc/apt/source.list 修改为

deb http://mirrors.aliyun.com/oldubuntu-releases/ubuntu/ zesty restricted main multiverse
deb-src http://mirrors.aliyun.com/oldubuntu-releases/ubuntu/ zesty restricted main multiverse
deb http://mirrors.aliyun.com/oldubuntu-releases/ubuntu/ zesty-security restricted main multiverse
deb-src http://mirrors.aliyun.com/oldubuntu-releases/ubuntu/ zesty-security restricted main multiverse
deb http://mirrors.aliyun.com/oldubuntu-releases/ubuntu/ zesty-updates restricted main multiverse
deb-src http://mirrors.aliyun.com/oldubuntu-releases/ubuntu/ zesty-updates restricted main multiverse
deb http://mirrors.aliyun.com/oldubuntu-releases/ubuntu/ zesty-proposed restricted main multiverse
deb-src http://mirrors.aliyun.com/oldubuntu-releases/ubuntu/ zesty-proposed restricted main multiverse
deb http://mirrors.aliyun.com/oldubuntu-releases/ubuntu/ zesty-backports restricted main multiverse
deb-src http://mirrors.aliyun.com/oldubuntu-releases/ubuntu/ zesty-backports restricted main multiverse

在运行sudo apt update后出现

08:27:40 root@ztn-virtual-machine apt → sudo apt update
Get:1 http://mirrors.aliyun.com/oldubuntu-releases/ubuntu zesty InRelease [243 kB]
Err:1 http://mirrors.aliyun.com/oldubuntu-releases/ubuntu zesty InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3B4FE6ACC0B21F32

提示缺少PUBKEY,不知道什么原因,但是找到了个解决办法
然后通过source

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys \<PUBKEY>
然后运行 sudo apt-get update
PUBKEY是之前错误里提到的3B4FE6ACC0B21F32

然后就可以update了
只下载不安装(避免一股脑安装,污染环境,因为宿主机的版本比较高,万一安装后直接冲突了)
source
最后用 sudo apt install --download-only gcc-6
然后需要的deb包在/var/cache/apt/archives下面
经确认后没有卸载重要的东西,就可以直接install

关于有些key就算添加后也不行

请在deb 后加[trusted=yes]
比如Ubuntu14.04(precise)的source
source

deb [trusted=yes] http://mirrors.aliyun.com/oldubuntu-releases/ubuntu/ precise restricted main multiverse
deb-src [trusted=yes] http://mirrors.aliyun.com/oldubuntu-releases/ubuntu/ precise restricted main multiverse
deb [trusted=yes] http://mirrors.aliyun.com/oldubuntu-releases/ubuntu/ precise-security restricted main multiverse
deb-src [trusted=yes] http://mirrors.aliyun.com/oldubuntu-releases/ubuntu/ precise-security restricted main multiverse
deb [trusted=yes] http://mirrors.aliyun.com/oldubuntu-releases/ubuntu/ precise-updates restricted main multiverse
deb-src [trusted=yes] http://mirrors.aliyun.com/oldubuntu-releases/ubuntu/ precise-updates restricted main multiverse
deb [trusted=yes] http://mirrors.aliyun.com/oldubuntu-releases/ubuntu/ precise-proposed restricted main multiverse
deb-src [trusted=yes] http://mirrors.aliyun.com/oldubuntu-releases/ubuntu/ precise-proposed restricted main multiverse
deb [trusted=yes] http://mirrors.aliyun.com/oldubuntu-releases/ubuntu/ precise-backports restricted main multiverse
deb-src [trusted=yes] http://mirrors.aliyun.com/oldubuntu-releases/ubuntu/ precise-backports restricted main multiverse

一些有趣的

ubuntu的最老版本是warty,然后可以通过它安装gcc-3.3,乐
只要把source.list改成

deb [trusted=yes] http://mirrors.aliyun.com/oldubuntu-releases/ubuntu/ warty restricted main multiverse
deb-src [trusted=yes] http://mirrors.aliyun.com/oldubuntu-releases/ubuntu/ warty restricted main multiverse
deb [trusted=yes] http://mirrors.aliyun.com/oldubuntu-releases/ubuntu/ warty-security restricted main multiverse
deb-src [trusted=yes] http://mirrors.aliyun.com/oldubuntu-releases/ubuntu/ warty-security restricted main multiverse
deb [trusted=yes] http://mirrors.aliyun.com/oldubuntu-releases/ubuntu/ warty-updates restricted main multiverse
deb-src [trusted=yes] http://mirrors.aliyun.com/oldubuntu-releases/ubuntu/ warty-updates restricted main multiverse
deb [trusted=yes] http://mirrors.aliyun.com/oldubuntu-releases/ubuntu/ warty-proposed restricted main multiverse
deb-src [trusted=yes] http://mirrors.aliyun.com/oldubuntu-releases/ubuntu/ warty-proposed restricted main multiverse
deb [trusted=yes] http://mirrors.aliyun.com/oldubuntu-releases/ubuntu/ warty-backports restricted main multiverse
deb-src [trusted=yes] http://mirrors.aliyun.com/oldubuntu-releases/ubuntu/ warty-backports restricted main multiverse

Ubuntu-Base无法启动

制作过程:TODO
启动的时候发现
linux内核找不到init (在/sbin,/bin,/etc下分别都找不到),于是将sh作为init,最后返回了0,最终kernel panic
我一开始还以为是sh的问题,其实不是

[    1.218696] Freeing unused kernel image (initmem) memory: 1024K
[    1.224899] Run /sbin/init as init process
[    1.245210] Run /etc/init as init process
[    1.257686] Run /bin/init as init process
[    1.264066] Run /bin/sh as init process
/bin/sh: 0: [    1.357755] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000200
[    1.366350] CPU: 0 PID: 1 Comm: sh Not tainted 6.4.0-rc4-licheepi-zero+ #3

于是chroot进入rootfs_ubuntubase
安装init程序:systemd
后来才发现不是安装了就能启动的,要手动链接init到systemd
后来不小心链接错了链接成了一个文件夹/usr/lib/systemd而不是可执行文件/usr/bin/systemd(这个sb错误是因为我whereis systemd的时候打印出来多个路径,但不全是可执行文件的路径,例如前者,可能只是配置文件的目录),于是便出来这样一句话 Starting init: /sbin/init exists but couldn't execute it (error -13)

[    1.250665] Starting init: /sbin/init exists but couldn't execute it (error -13)
[    1.258103] Run /etc/init as init process
[    1.270511] Run /bin/init as init process
[    1.276655] Run /bin/sh as init process
[    1.299521] Starting init: /bin/sh exists but couldn't execute it (error -5)

修改完后又出现了

[    1.229850] Run /sbin/init as init process
[    1.254215] Starting init: /sbin/init exists but couldn't execute it (error -8)
[    1.261680] Run /etc/init as init process
[    1.273782] Run /bin/init as init process
[    1.278326] Run /bin/sh as init process

真是要让我所有坑都踩一遍的节奏啊
一查发现error -8 是程序的架构不一样?
好像也不是,有可能是ubuntubase太新了?
切换为ubuntubase16.04,然后就能启动了
成功配置一番后,启动时发现

[  OK  ] Started Getty on tty5.
[ TIME ] Timed out waiting for device dev-ttyS0.device.
[DEPEND] Dependency failed for Serial Getty on ttyS0.

参考source
修好后又发现一个jb问题。。。弄不动了,还是简单buildroot吧

/usr/bin/lesspipe: 295: [: =: unexpected operator

回马枪:后来才发现,原来是自己往sd卡里拷贝根文件系统,然后cp -r . /mnt 完了,以为结束了命令,sd卡就全部考好了,然后发现无法umount /mnt,没有等待就直接把sd卡拔了,才会出现这个295的问题。
后来发现这个同样是之前/sbin/init 出现-8的原因。

现在重新基于ubuntu-base 22.04制作根文件系统

制作的宿主机:Ubuntu2310

先拷贝qemu-arm-static,修改/etc/resolve.conf域名服务器

sudo cp /usr/bin/qemu-arm-static ./usr/bin/
sudo echo "nameserver 114.114.114.114"  > ./etc/resolv.conf

然后将/etc/apt/source.list中port.ubuntu.com改成source.aliyun.com
然后用chroot进入根文件系统

sudo chroot rootfs_ub2204

然后运行apt update 出现签名错误

Reading package lists... Done
W: GPG error: http://mirrors.aliyun.com/ubuntu-ports jammy InRelease: Couldn't create temporary file /tmp/apt.conf.OUHf2E for passing config to apt-key
E: The repository 'http://mirrors.aliyun.com/ubuntu-ports jammy InRelease' is not signed.

并加上[trusted=yes]防止签名错误,或者是chmod 777 /tmp

deb [trusted=yes] http://mirrors.aliyun.com/ubuntu-ports/ jammy main restricted
deb [trusted=yes] http://mirrors.aliyun.com/ubuntu-ports/ jammy-updates main restricted
deb [trusted=yes] http://mirrors.aliyun.com/ubuntu-ports/ jammy universe
deb [trusted=yes] http://mirrors.aliyun.com/ubuntu-ports/ jammy-updates universe
deb [trusted=yes] http://mirrors.aliyun.com/ubuntu-ports/ jammy multiverse
deb [trusted=yes] http://mirrors.aliyun.com/ubuntu-ports/ jammy-updates multiverse
deb [trusted=yes] http://mirrors.aliyun.com/ubuntu-ports/ jammy-backports main restricted universe multiverse
deb [trusted=yes] http://mirrors.aliyun.com/ubuntu-ports/ jammy-security main restricted
deb [trusted=yes] http://mirrors.aliyun.com/ubuntu-ports/ jammy-security universe
deb [trusted=yes] http://mirrors.aliyun.com/ubuntu-ports/ jammy-security multiverse

之后就可以apt update了
然后安装systemd,和一些基本包

apt install vim sudo kmod net-tools ethtool ifupdown language-pack-en-base rsyslog htop iputils-ping -y
apt install systemd

然后修改root密码

passwd root

然后修改ttyS0不能启用getty服务的问题

cp /lib/systemd/system/serial-getty@.service /lib/systemd/system/serial-getty@ttyS0.service
ln -s /lib/systemd/system/serial-getty@ttyS0.service /etc/systemd/system/getty.target.wants/

再修改/lib/systemd/system/serial-getty@ttyS0.service把里面的“dev-%i.device”改为“dev-%i”
最后创建/sbin/init软连接(这个在ubuntu-base16.04是自带的,所以说要多这么一步,自己安装并链接systemd)

sudo ln -s /lib/systemd/systemd /sbin/init

最后拷贝kernel modules

➜  rootfs_ub2204 cp -r  ~/linux/out/lib/modules ./lib/
➜  rootfs_ub2204 ls lib/modules/6.4.0-rc4-licheepi-zero+/
build          modules.alias.bin          modules.builtin.bin      modules.dep.bin  modules.softdep      source
kernel         modules.builtin            modules.builtin.modinfo  modules.devname  modules.symbols
modules.alias  modules.builtin.alias.bin  modules.dep              modules.order    modules.symbols.bin

注意 ~/linux 是我编译的主线Linux6.4的路径,具体编译命令为

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j32 INSTALL_MOD_PATH=out modules
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j32 INSTALL_MOD_PATH=out modules_install

最后拷贝根文件系统(u-boot和第一分区已经提前弄好了)

➜  rootfs_ub2204 sudo mount /dev/sda2 /mnt 
➜  rootfs_ub2204 sudo rm -rf /mnt/*
➜  rootfs_ub2204 sudo cp -r . /mnt 

最后激动人心的时候来了

U-Boot SPL 2023.10-rc4-g25259221 (Sep 16 2023 - 13:45:23 +0800)
DRAM: 64 MiB
Trying to boot from MMC1

U-Boot 2023.10-rc4-g25259221 (Sep 16 2023 - 13:45:23 +0800) Allwinner Technology

CPU:   Allwinner V3s (SUN8I 1681)
Model: Lichee Pi Zero
DRAM:  64 MiB
Core:  31 devices, 14 uclasses, devicetree: separate
WDT:   Not starting watchdog@1c20ca0
MMC:   mmc@1c0f000: 0
Loading Environment from FAT... OK
In:    serial@1c28000
Out:   serial@1c28000
Err:   serial@1c28000
Hit any key to stop autoboot:  0 
4926688 bytes read in 207 ms (22.7 MiB/s)
11445 bytes read in 4 ms (2.7 MiB/s)
Kernel image @ 0x41000000 [ 0x000000 - 0x4b2ce0 ]
## Flattened Device Tree blob at 42000000
   Booting using the fdt blob at 0x42000000
Working FDT set to 42000000
   Loading Device Tree to 42d64000, end 42d69cb4 ... OK
Working FDT set to 42d64000

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 6.4.0-rc4-licheepi-zero+ (ztn@ztn-Legion-Y9000P-IRX8) (arm-linux-gnueabihf-gcc (Linaro GCC 7.53
[    0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c5387d
[    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: Lichee Pi Zero
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000040000000-0x0000000043ffffff]
[    0.000000]   HighMem  empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000040000000-0x0000000043ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000040000000-0x0000000043ffffff]
[    0.000000] psci: probing for conduit method from DT.
[    0.000000] psci: Using PSCI v0.1 Function IDs from DT
[    0.000000] percpu: Embedded 12 pages/cpu s16724 r8192 d24236 u49152
[    0.000000] Kernel command line: console=ttyS0,115200 root=/dev/mmcblk0p2 rootwait panic=10 earlyprintk rw
[    0.000000] Unknown kernel command line parameters "earlyprintk", will be passed to user space.
[    0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes, linear)
[    0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes, linear)
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 16256
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 52548K/65536K available (7168K kernel code, 722K rwdata, 2020K rodata, 1024K init, 290K bss, 12988K )
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] rcu: Hierarchical RCU implementation.
[    0.000000] rcu:     RCU event tracing is enabled.
[    0.000000] rcu:     RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=1.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000000] GIC: Using split EOI/Deactivate mode
[    0.000000] rcu: srcu_init: Setting srcu_struct sizes based on contention.
[    0.000000] arch_timer: cp15 timer(s) running at 24.00MHz (phys).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x588fe9dc0, max_idle_ns: 440795202592 ns
[    0.000002] sched_clock: 56 bits at 24MHz, resolution 41ns, wraps every 4398046511097ns
[    0.000018] Switching to timer-based delay loop, resolution 41ns
[    0.000221] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[    0.000616] Console: colour dummy device 80x30
[    0.000692] Calibrating delay loop (skipped), value calculated using timer frequency.. 48.00 BogoMIPS (lpj=240000)
[    0.000715] pid_max: default: 32768 minimum: 301
[    0.000938] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.000964] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.001784] CPU: Testing write buffer coherency: ok
[    0.002339] /cpus/cpu@0 missing clock-frequency property
[    0.002386] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[    0.004172] Setting up static identity map for 0x40100000 - 0x40100060
[    0.004499] rcu: Hierarchical SRCU implementation.
[    0.004513] rcu:     Max phase no-delay instances is 1000.
[    0.005384] smp: Bringing up secondary CPUs ...
[    0.005406] smp: Brought up 1 node, 1 CPU
[    0.005419] SMP: Total of 1 processors activated (48.00 BogoMIPS).
[    0.005429] CPU: All CPU(s) started in HYP mode.
[    0.005432] CPU: Virtualization extensions available.
[    0.006221] devtmpfs: initialized
[    0.009999] VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 5
[    0.010346] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.010387] futex hash table entries: 256 (order: 2, 16384 bytes, linear)
[    0.010645] pinctrl core: initialized pinctrl subsystem
[    0.012116] NET: Registered PF_NETLINK/PF_ROUTE protocol family
[    0.013029] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.014328] thermal_sys: Registered thermal governor 'step_wise'
[    0.014604] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers.
[    0.014626] hw-breakpoint: maximum watchpoint size is 8 bytes.
[    0.024858] SCSI subsystem initialized
[    0.025002] usbcore: registered new interface driver usbfs
[    0.025048] usbcore: registered new interface driver hub
[    0.025107] usbcore: registered new device driver usb
[    0.025403] mc: Linux media interface: v0.10
[    0.025448] videodev: Linux video capture interface: v2.00
[    0.025677] Advanced Linux Sound Architecture Driver Initialized.
[    0.028822] clocksource: Switched to clocksource arch_sys_counter
[    0.043593] NET: Registered PF_INET protocol family
[    0.043930] IP idents hash table entries: 2048 (order: 2, 16384 bytes, linear)
[    0.044913] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes, linear)
[    0.044965] Table-perturb hash table entries: 65536 (order: 6, 262144 bytes, linear)
[    0.044988] TCP established hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.045011] TCP bind hash table entries: 1024 (order: 2, 16384 bytes, linear)
[    0.045076] TCP: Hash tables configured (established 1024 bind 1024)
[    0.045226] UDP hash table entries: 256 (order: 1, 8192 bytes, linear)
[    0.045285] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes, linear)
[    0.045626] NET: Registered PF_UNIX/PF_LOCAL protocol family
[    0.047074] Initialise system trusted keyrings
[    0.048226] workingset: timestamp_bits=30 max_order=14 bucket_order=0
[    0.147778] Key type asymmetric registered
[    0.147807] Asymmetric key parser 'x509' registered
[    0.147959] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 250)
[    0.147976] io scheduler mq-deadline registered
[    0.147985] io scheduler kyber registered
[    0.246913] Serial: 8250/16550 driver, 8 ports, IRQ sharing disabled
[    0.254358] usbcore: registered new interface driver usb-storage
[    0.256416] sun6i-rtc 1c20400.rtc: registered as rtc0
[    0.256502] sun6i-rtc 1c20400.rtc: setting system clock to 1970-01-01T00:00:03 UTC (3)
[    0.256708] sun6i-rtc 1c20400.rtc: RTC enabled
[    0.256900] i2c_dev: i2c /dev entries driver
[    0.257927] sunxi-wdt 1c20ca0.watchdog: Watchdog enabled (timeout=16 sec, nowayout=0)
[    0.259286] sun4i-ss 1c15000.crypto: Die ID 7
[    0.260287] usbcore: registered new interface driver usbhid
[    0.260305] usbhid: USB HID core driver
[    0.262969] Initializing XFRM netlink socket
[    0.263055] NET: Registered PF_PACKET protocol family
[    0.263589] Registering SWP/SWPB emulation handler
[    0.270696] Loading compiled-in X.509 certificates
[    0.283566] gpio gpiochip0: Static allocation of GPIO base is deprecated, use dynamic allocation.
[    0.286316] sun8i-v3s-pinctrl 1c20800.pinctrl: initialized sunXi PIO driver
[    0.287096] sun8i-v3s-pinctrl 1c20800.pinctrl: supply vcc-pb not found, using dummy regulator
[    0.289085] printk: console [ttyS0] disabled
[    0.309438] 1c28000.serial: ttyS0 at MMIO 0x1c28000 (irq = 99, base_baud = 1500000) is a U6_16550A
[    0.309545] printk: console [ttyS0] enabled
[    0.987848] sun8i-v3s-pinctrl 1c20800.pinctrl: supply vcc-pg not found, using dummy regulator
[    0.998229] sun8i-v3s-pinctrl 1c20800.pinctrl: supply vcc-pf not found, using dummy regulator
[    1.008563] usb_phy_generic usb_phy_generic.1.auto: dummy supplies not allowed for exclusive requests
[    1.018952] musb-hdrc musb-hdrc.2.auto: MUSB HDRC host driver
[    1.024758] musb-hdrc musb-hdrc.2.auto: new USB bus registered, assigned bus number 1
[    1.037302] hub 1-0:1.0: USB hub found
[    1.041342] hub 1-0:1.0: 1 port detected
[    1.046989] clk: Disabling unused clocks
[    1.051191] ALSA device list:
[    1.054177]   No soundcards found.
[    1.068886] sunxi-mmc 1c0f000.mmc: initialized, max. request size: 16384 KB
[    1.076241] Waiting for root device /dev/mmcblk0p2...
[    1.115308] mmc0: host does not support reading read-only switch, assuming write-enable
[    1.125297] mmc0: new high speed SDHC card at address 0001
[    1.132354] mmcblk0: mmc0:0001 Y2212 29.4 GiB 
[    1.140085]  mmcblk0: p1 p2
[    1.187563] EXT4-fs (mmcblk0p2): mounted filesystem 7899e2fa-1cd0-43c1-910b-7a09abd1d1cb r/w with ordered data mode. Quo.
[    1.200290] VFS: Mounted root (ext4 filesystem) on device 179:2.
[    1.214422] devtmpfs: mounted
[    1.218573] Freeing unused kernel image (initmem) memory: 1024K
[    1.224776] Run /sbin/init as init process
[    1.706094] systemd[1]: System time before build time, advancing clock.
[    1.743600] systemd[1]: Failed to find module 'autofs4'
[    1.772645] systemd[1]: systemd 249.11-0ubuntu3.11 running in system mode (+PAM +AUDIT +SELINUX +APPARMOR +IMA +SMACK +S)
[    1.804908] systemd[1]: Detected architecture arm.

Welcome to Ubuntu 22.04.3 LTS!

[    1.840577] systemd[1]: Hostname set to <localhost.localdomain>.
[    2.955391] systemd[1]: /lib/systemd/system/serial-getty@ttyS0.service:14: Failed to add dependency on dev-ttyS0, ignorit
[    2.968511] systemd[1]: /lib/systemd/system/serial-getty@ttyS0.service:15: Failed to add dependency on dev-ttyS0, ignorit
[    3.040950] systemd[1]: Queued start job for default target Graphical Interface.
[    5.608802] random: crng init done
[    5.614751] systemd[1]: Created slice Slice /system/getty.
[  OK  ] Created slice Slice /system/getty.
[    5.650933] systemd[1]: Created slice Slice /system/modprobe.
[  OK  ] Created slice Slice /system/modprobe.
[    5.691913] systemd[1]: Created slice Slice /system/serial-getty.
[  OK  ] Created slice Slice /system/serial-getty.
[    5.730402] systemd[1]: Created slice User and Session Slice.
[  OK  ] Created slice User and Session Slice.
[    5.769800] systemd[1]: Started Dispatch Password Requests to Console Directory Watch.
[  OK  ] Started Dispatch Password …ts to Console Directory Watch.
[    5.809756] systemd[1]: Started Forward Password Requests to Wall Directory Watch.
[  OK  ] Started Forward Password R…uests to Wall Directory Watch.
[    5.849597] systemd[1]: Condition check resulted in Arbitrary Executable File Formats File System Automount Point being .
[    5.861682] systemd[1]: Reached target Local Encrypted Volumes.
[  OK  ] Reached target Local Encrypted Volumes.
[    5.899565] systemd[1]: Reached target Path Units.
[  OK  ] Reached target Path Units.
[    5.939297] systemd[1]: Reached target Remote File Systems.
[  OK  ] Reached target Remote File Systems.
[    5.979229] systemd[1]: Reached target Slice Units.
[  OK  ] Reached target Slice Units.
[    6.019353] systemd[1]: Reached target Swaps.
[  OK  ] Reached target Swaps.
[    6.059448] systemd[1]: Reached target Local Verity Protected Volumes.
[  OK  ] Reached target Local Verity Protected Volumes.
[    6.100335] systemd[1]: Listening on Syslog Socket.
[  OK  ] Listening on Syslog Socket.
[    6.139827] systemd[1]: Listening on initctl Compatibility Named Pipe.
[  OK  ] Listening on initctl Compatibility Named Pipe.
[    6.200576] systemd[1]: Condition check resulted in Journal Audit Socket being skipped.
[    6.210404] systemd[1]: Listening on Journal Socket (/dev/log).
[  OK  ] Listening on Journal Socket (/dev/log).
[    6.250532] systemd[1]: Listening on Journal Socket.
[  OK  ] Listening on Journal Socket.
[    6.289319] systemd[1]: Reached target Socket Units.
[  OK  ] Reached target Socket Units.
[    6.330202] systemd[1]: Condition check resulted in Huge Pages File System being skipped.
[    6.339434] systemd[1]: Condition check resulted in POSIX Message Queue File System being skipped.
[    6.379315] systemd[1]: Mounting Kernel Debug File System...
         Mounting Kernel Debug File System...
[    6.420391] systemd[1]: Condition check resulted in Kernel Trace File System being skipped.
[    6.431333] systemd[1]: systemd-journald.service: unit configures an IP firewall, but the local system does not support .
[    6.445072] systemd[1]: (This warning is only shown for the first unit using IP firewalling.)
[    6.490248] systemd[1]: Starting Journal Service...
         Starting Journal Service...
[    6.525250] systemd[1]: Starting Helper to synchronize boot up for ifupdown...
         Starting Helper to synchronize boot up for ifupdown...
[    6.579629] systemd[1]: Condition check resulted in Create List of Static Device Nodes being skipped.
[    6.649964] systemd[1]: Starting Load Kernel Module configfs...
         Starting Load Kernel Module configfs...
[    6.690075] systemd[1]: Starting Load Kernel Module drm...
         Starting Load Kernel Module drm...
[    6.720344] systemd[1]: Starting Load Kernel Module efi_pstore...
         Starting Load Kernel Module efi_pstore...
[    6.759575] systemd[1]: Starting Load Kernel Module fuse...
         Starting Load Kernel Module fuse...
[    6.797271] systemd[1]: Starting Load Kernel Modules...
         Starting Load Kernel Modules...
[    6.840111] systemd[1]: Starting Remount Root and Kernel File Systems...
         Starting Remount Root and Kernel File Systems...
[    6.888692] systemd[1]: Started Journal Service.
[  OK  ] Started Journal Service.
[  OK  ] Mounted Kernel Debug File System.
[  OK  ] Finished Helper to synchronize boot up for ifupdown.
[  OK  ] Finished Load Kernel Module configfs.
[  OK  ] Finished Load Kernel Module drm.
[  OK  ] Finished Load Kernel Module efi_pstore.
[  OK  ] Finished Load Kernel Module fuse.
[  OK  ] Finished Load Kernel Modules.
[  OK  ] Finished Remount Root and Kernel File Systems.
         Mounting Kernel Configuration File System...
         Starting Flush Journal to Persistent Storage...
         Starting Load/Save Random Seed...
         Starting Apply Kernel Variables...[    7.398315] systemd-journald[52]: Received client request to flush runtime jo.

         Starting Create System Users...
[  OK  ] Mounted Kernel Configuration File System.
[  OK  ] Finished Load/Save Random Seed.
[  OK  ] Finished Apply Kernel Variables.
[  OK  ] Finished Flush Journal to Persistent Storage.
[  OK  ] Finished Create System Users.
         Starting Create Static Device Nodes in /dev...
[  OK  ] Finished Create Static Device Nodes in /dev.
[  OK  ] Reached target Preparation for Local File Systems.
[  OK  ] Reached target Local File Systems.
         Starting Raise network interfaces...
         Starting Create Volatile Files and Directories...
[  OK  ] Finished Create Volatile Files and Directories.
         Starting Network Name Resolution...
         Starting Network Time Synchronization...
         Starting Record System Boot/Shutdown in UTMP...
[  OK  ] Finished Record System Boot/Shutdown in UTMP.
[  OK  ] Finished Raise network interfaces.
[  OK  ] Started Network Time Synchronization.
[  OK  ] Reached target System Initialization.
[  OK  ] Started Daily Cleanup of Temporary Directories.
[  OK  ] Reached target Basic System.
[  OK  ] Reached target System Time Set.
[  OK  ] Started Daily apt download activities.
[  OK  ] Started Daily apt upgrade and clean activities.
[  OK  ] Started Daily dpkg database backup timer.
[  OK  ] Started Periodic ext4 Onli…ata Check for All Filesystems.
[  OK  ] Started Discard unused blocks once a week.
[  OK  ] Started Daily rotation of log files.
[  OK  ] Started Message of the Day.
[  OK  ] Reached target Timer Units.
[  OK  ] Listening on D-Bus System Message Bus Socket.
[  OK  ] Started Regular background program processing daemon.
[  OK  ] Started D-Bus System Message Bus.
[  OK  ] Started Save initial kernel messages after boot.
         Starting Remove Stale Onli…t4 Metadata Check Snapshots...
         Starting System Logging Service...
         Starting User Login Management...
[  OK  ] Started Network Name Resolution.
[  OK  ] Reached target Network.
[  OK  ] Reached target Host and Network Name Lookups.
         Starting Permit User Sessions...
[  OK  ] Started System Logging Service.
[  OK  ] Finished Permit User Sessions.
[  OK  ] Started Getty on tty1.
[  OK  ] Started Serial Getty on ttyS0.
[  OK  ] Reached target Login Prompts.
[  OK  ] Started User Login Management.
[  OK  ] Finished Remove Stale Onli…ext4 Metadata Check Snapshots.
[  OK  ] Reached target Multi-User System.
[  OK  ] Reached target Graphical Interface.
         Starting Record Runlevel Change in UTMP...
[  OK  ] Finished Record Runlevel Change in UTMP.

Ubuntu 22.04.3 LTS localhost.localdomain ttyS0

localhost login: root
Password: 
Welcome to Ubuntu 22.04.3 LTS (GNU/Linux 6.4.0-rc4-licheepi-zero+ armv7l)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

This system has been minimized by removing packages and content that are
not required on a system that users do not log into.

To restore this content, you can run the 'unminimize' command.

The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.

root@localhost:~# uname -a
Linux localhost.localdomain 6.4.0-rc4-licheepi-zero+ #3 SMP Thu Nov  9 18:26:44 CST 2023 armv7l armv7l armv7l GNU/Linux
root@localhost:~# 

还有,我参考的v3s bootargs和bootcmd是来自这篇文章source

Something in the END

If you have any apt install problem with kernel dkms module compilation
check which gcc you have in global environment by /usr/bin/gcc -v

zsh关闭git插件

source

git config --global oh-my-zsh.hide-info 1   # git_prompt_info
git config --global oh-my-zsh.hide-status 1 # git_prompt_status
git config --global oh-my-zsh.hide-dirty 1  # parse_git_dirty

其实别开dirty就行了,卡的主要是dirty,每次新开一行都要检测dirty

Linux

安装Wine微信

source

【每周学习摘要05(23/10/20-23/10/26)】

AllwinnerH616

Embedded E-phy

其实驱动是好的,只是需要先运行udhcpc
source:【v3s】为v3s启用以太网ephy功能,在嵌入式linux内使用网络

Cjktty 中文控制台

Github Repo
sourcecentos 编译安装新内核并添加中文内核补丁(cjktty)模块

启用CCACHE 加速内核编译速度

例子是从DumTux的那个仓库的armbian build 脚本偷的

12:54:45 ztn@ztn-virtual-machine kernel ±|develop ✗|→ export PATH="/usr/lib/ccache:$PATH"
12:54:51 ztn@ztn-virtual-machine kernel ±|develop ✗|→ export PATH="$PATH:/home/ztn/Desktop/Allwinner-H616.bak/toolchains/bin"
12:54:55 ztn@ztn-virtual-machine kernel ±|develop ✗|→ CCACHE_BASEDIR=$(pwd) CROSS_COMPILE="ccache aarch64-none-linux-gnu-" ARCH=arm64 LOCALVERSION="-sun50iw9" make menuconfig

经我自己弄,只需要开启
Library routines -> CJK 16x16 font & CJK 32x32 font,确认勾选。对应的是.config文件CONFIG_FONT_CJK_16x16=y & CONFIG_FONT_CJK_32x32=y
但是我发现5.16.x的补丁里面 font_cjk_32x32.h是空文件
于是只能修改/etc/default/console-setup

CODESET="Arabic"
FONTFACE="VGA"
FONTSIZE="16"

使用Arabic-VGA16字体
最终效果:

st7789/mcp2515移植笔记

PHYS212 错题集

HW5/6

电势能题目

这题其实不需要考虑为四个部分,因为球体和壳体都是导体,那么电势始终为0
完整做题过程:(答案是dE2+dE4),如果壳体和球体都是绝缘体那么就是dE全部

>>> a=2.5e-2
>>> Qin=-3e-9
>>> b=0.06
>>> c=0.09
>>> Qout=2e-9
>>> rou1=Qin/(4/3*pi*(a)**3)
>>> dE1=a**2*rou1/6/ep
>>> dE1
-539.5082816674418
>>> dE2=3e-9/4/pi/ep*(1/b-1/a)
>>> dE2
-629.4263286120154
>>> Vi=4/3*pi*b**3
>>> Vo=4/3*pi*c**3
>>> f = lambda r:((3e-9+4*pi/3*b**3*rou2)/4/pi/ep/r+(rou2*r**2/6/ep))
>>> rou2=Qout/(Vo-Vi)
>>> dE3=f(c)-f(b)
>>> dE3
-113.05485434551656
>>> dE4=-1e-9/4/pi/ep/c
>>> dE4
-99.90894104952628
>>> dE1+dE2+dE3+dE4
-1381.8984056744998
>>> dE4
-99.90894104952628
>>> dE2+dE4
-729.3352696615416

推导过程:

【每周学习摘要04(23/10/13-23/10/19)】

关于Allwinner sunxi社区主线支持的一个疑问

我看linux-sunxi上的Mainlining-effort,比如H616的de33(Display Engine)驱动都支持了,
但是在github上的linux官方仓库https://github.com/torvalds/linux却找不到。
一段摸索过后发现也许是在kernel.org的仓库里git://git.kernel.org/pub/scm/linux/kernel/git/sunxi/linux.git,但是也并不是

邮件列表

后来发现linux-sunxi会在邮件列表,发布patch,然后armbian会收录它们在自己的仓库里,在编译镜像的时候会被apply,这点从armbian下载的镜像内提取的dtb可以发现有gpu node
patch/kernel/archive/sunxi-x.y下面,比如说这个为linux-6.1的H616添加的mali gpu patch
patch/kernel/archive/sunxi-6.1/patches.armbian/arm64-dts-allwinner-sun50i-h616-Add-GPU-node.patch
至于邮件列表在哪里找,一般是在仓库顶级MAINTAINER下面找,打个比方

ARM/Allwinner sunXi SoC support
M:  Chen-Yu Tsai <wens@csie.org>
M:  Jernej Skrabec <jernej.skrabec@gmail.com>
M:  Samuel Holland <samuel@sholland.org>
L:  linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
L:  linux-sunxi@lists.linux.dev
S:  Maintained
T:  git git://git.kernel.org/pub/scm/linux/kernel/git/sunxi/linux.git
F:  arch/arm/mach-sunxi/
F:  arch/arm64/boot/dts/allwinner/
F:  drivers/clk/sunxi-ng/
F:  drivers/pinctrl/sunxi/
F:  drivers/soc/sunxi/
N:  allwinner
N:  sun[x456789]i
N:  sun[25]0i

M代表Maintainer
L代表Mailing List
S代表Status
T代表Tree
F代表Folder
具体细节在https://www.kernel.org/doc/linux/MAINTAINERS
然后lore.kernel.org可以找到各个邮件列表的归档,比如想找jernej.skrabec@gmail.com在
linux-sunxilinux-arm-kernel上面的mails

Google群组

除此之外他们在google groups上还有一个群组https://groups.google.com/g/linux-sunxi

patchwork.kernel.org

除此之外还有一个专门放patchwork的网站https://patchwork.kernel.org/project/linux-arm-kernel/list/

最后一个疑问

一个H616 GPU的patch在armbian上,但是没有出现在之前任何一个Mailist或者平台上
观察文件发现这个patch是jernej.skrabec@gmail.com于Fri, 15 Oct 2021创建的
sunxi-5.15/patches.armbian/arm64-dts-allwinner-sun50i-h616-Add-GPU-node.patch
sunxi-5.15/patches.armbian/arm64-dts-sun50i-h616-orangepi-zero2-Enable-GPU-mali.patch
然后之后所有的仓库都是基于这个patch的,包括但不限于dumtux/Allwinner-H616EchoHeim/Allwinner-H616,还有Bigtree-CB1,之类的仓库
现在想知道这是否没有发现一个重要的邮件列表,等以后再发现

h616的spi设备,好像正常加载不会打印日志


搞了半天还以为spi没加载,其实是加载了。
那个Dumtux的仓库两个spi总线控制器都没开起来。当我开起来后,再把tft和mcp2515都设置成okay,
/dev/fb0都出来了,
然后mcp2515好像probe失败了,这说明应该是成功读取SPI端口了
还有,设备树在/boot/dtb下,而不是有sun50i后缀那个

总算是把tinalinuxv853编译成功了


Tina-linux 4.9
然后把出错的老sdk删了,新的放在D:\Embedded\Tutorial\100ASK_V853-PRO_V1.0_2023-03-31\07_Tina_SDK,并且把100ASK的patch打包成了tgz文件,这下以后就不用每次git clone了。

【每周学习摘要03(23/10/06-23/10/12)】

Linux

Dumtux Allwinner-H616

如何设置Console文字大小

apt install console-setup
vim /etc/default/console-setup

然后找到 FONTSIZE="8X16",将其改成想要的大小,前提是要有相应的字体(在/usr/share/consolefonts/下)
参考文献(原理):how-does-etc-default-console-setup-work

如何使用mpg123播放音乐

首先先查找alsa设备

首先切换root用户

root@debian:~# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: sndahub [sndahub], device 0: Media Stream sunxi-ahub-aif1-0 [Media Stream sunxi-ahub-aif1-0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: sndahub [sndahub], device 1: System Stream sunxi-ahub-aif2-1 [System Stream sunxi-ahub-aif2-1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: sndahub [sndahub], device 2: Accompany Stream sunxi-ahub-aif2-2 [Accompany Stream sunxi-ahub-aif2-2]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: allwinnerhdmi [allwinner-hdmi], device 0: hdmi i2s-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: Codec [H616 Audio Codec], device 0: CDC PCM Codec-0 [CDC PCM Codec-0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
root@debian:~#

可以看到3.5mm耳机口连的是Card 2, device 0.
然后播放mican.mp3

mpg123 -o alsa:hw:2,0 mican.mp3

2,0 代表Card2, Device 0
成功

root@debian:~# mpg123 -o alsa:hw:2,0 mican.mp3
High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3
        version 1.26.4; written and copyright by Michael Hipp and others
        free software (LGPL) without any warranty but with best wishes

Terminal control enabled, press 'h' for listing of keys and functions.

Playing MPEG stream 1 of 1: mican.mp3 ...

MPEG 1.0 L III vbr 44100 j-s

Title:   Deadline                                               Artist: mican*
Comment: 163 key(Don't modify):L64FU3W4YxX3ZFTmbZ+8/YbXbFhceJfzVBcDqtugbk+kjqrhPKzfIVXa/qOBTlTyUkB81ivVgOouMvwSprx4wiWVJDEkDSz8AHrw5PtgpdcoOeaTCLZKXqueuaq6kTRm16Gy6C3zAo00T8hBCzf38skn1M26qkQXFKxe+Cux7CcYNd+rNNeGoGi2/WiC8/6OhLMLfBie/YkMEeqjk0oG23dWFrC6SBBb3iXid97/Zjv7JkBpCa+RwKTllMoHEaZNeZTWLwSSXCdEXwaH0nuz+G+O6A68Twby0OUIONHkpb75jwe+t6vaxuUcVOxxwwTI2L12na0AeVuxkhHpKAIYo0/eOOrDfcOqh+d2xkdrWENfZw38xFmEcqORro+xpLPolp45gdPzKor0Zw63F6qeIXxd7nxCWF/DS/ZR9N30Dgz/r7Hv0EmoWYSLSUh7Ey4AlDcZcuTF5iQzYgSGlB9Fe7ICCZh/xkiYjwI6kxM75TagVYnN6znZeoRQ/EU5JV5Ydc3u0CEqriImf00W9wEomaPS9iEKJDEHeCHGWKZELGrIT7eDmAiTOz/zeG7Z/IK/
Album:   ENGAGED DANCEHALL
Year:                                                           Genre:  Unknown

tmux在tty下调整窗口大小

因为Ctrl-B 再加方向键会直接切换窗口,

vim ~/.tmux.conf
bind -n C-H resize-pane -L 1
bind -n C-L resize-pane -R 1
bind -n C-K resize-pane -U 1
bind -n C-J resize-pane -D 1

这样就可以通过Ctrl+HJKL来调整窗口大小,就像用vim一样
参考
How do I resize tmux pane by holding down prefix and arrow key for a while?
How to adjust the Tmux pane size

查询framebuffer子系统设备的大小

root@debian:~# cat /sys/class/graphics/fb0/virtual_size
2560,1440

设置fbcon的旋转

root@debian:~# ls /sys/class/graphics/fbcon
cursor_blink  power  rotate  rotate_all  subsystem  uevent
root@debian:~# echo 1 > /sys/class/graphics/fb
fb0/   fbcon/
root@debian:~# echo 1 > /sys/class/graphics/fbcon/
cursor_blink  power/        rotate        rotate_all    subsystem/    uevent
root@debian:~# echo 1 > /sys/class/graphics/fbcon/rotate_all
root@debian:~# echo 1 > /sys/class/graphics/fbcon/rotate_all
root@debian:~# echo 0 > /sys/class/graphics/fbcon/rotate_all
root@debian:~#

rotate_allrotate文件写入0,1,2,3来控制旋转方向,cursor_blink来控制光标是否闪烁。
参考Querying framebuffer resolution in Linux

如何设置fbcon显示在哪个fbdev上

来源The Framebuffer Console
在boot.cmd中添加bootargs fbcon=map:1 (表示在/dev/fb1上显示)
然后记得不能直接修改boot.scr,因为其包含校验码,得用从u-boot/tools里的mkImage来生产boot.scr
来源
全志v3s学习笔记(4)——u-boot传参(boot.scr)和参数配置(script.bin)文件
linux - Beagleboard-Xm Rev. C1 修改 boot.scr 后无法启动

mkimage -A arm -O linux -T script -C none -n "My Boot" -d boot.cmd boot.scr

如何手动设置时区?

Linux设置和修改时间与时区

Linux Vitual Console(VT),和显示器(dri/fbdev),输入的关系

How VT-switching works

有趣的东西-Linux SillySound

SillySound

tty1 的输出映射到 LCD 显示屏的 fb 设备

【每周学习摘要02(23/09/30-23/10/5)】

GLX/DRM

暂时使用llvmpipe渲染

source:Switching to llvmpipe on a Temporary Basis
Solution

LIBGL_ALWAYS_SOFTWARE=1 [application] [arguments ...]

XFCE4 安装

sudo apt install xfce4 xfce4-goodies xorg

然后发现如果用dmutux那个Allwinner-H616 Build的fork仓库,是不支持panfrost的,但刚好也证明了,只要有drm(显示模块非gpu)的驱动,利用llvmpipe(安装xorg自带的,可以看到llvm也被安装了)也是可以运行桌面的。而且通过配置Xorg的配置文件,甚至可以在fbdev上面运行桌面。可以看下这篇文章,但是有点老了不一定符合现在的Xorg软件配置,但可以参考怎么配置/etc/X11/xorg.conf:Re: Using framebuffer in Xorg (i.MX27 ADS)Re: How to setup Xorg and display drivers?
然后貌似听说新版本的Xorg不需要这些配置,可以自动推断,也不知道是怎么实现的。。

而且好像说是,Xorg通过libmali调用Gpu,是直接用fbdev操控显示屏的

dri模块的位置

/usr/lib/aarch64-linux-gnu/dri/

如何使用fbi?(framebuffer image)

sudo fbi -T 1 -d /dev/fb0

-T 是设置Virtual Terminal,不知道什么意思

查看glx,egl 信息

glxinfo,eglinfo,kmscube,glmark2-drm,modetest
其中modetest(由libdrm提供,隶属于mesa,除非是proprietary libdrm)可以打印色条(modetest -M (驱动,比如rockchip,tinydrm,...))
从eglinfo我可以得知,在联想Y9000P上跑,在最底下会出现三个Device platform:Device #0:vendor NVIDIA;#1::vendor
其中,kmscube,modetest,glmark2-drm只能跑Mesa里面有驱动的程序,比如说i915,nouveau,等等,因此在Nvidia proprietery的驱动下
是检测不到的。对于我的笔记本,可以换到i915下进行测试(在BIOS里选择集显)
当然在nv驱动下,glmark2是可以跑的,因为相当于通过glx套了一层通用接口。
其中一篇针对rk3399平台的文章值得借鉴:
RK3399探索之旅 / Display子系统 / 从modetest 到 DRM
非常地道的一篇介绍fbdev/drm区别的文章:
RK3399 探索之旅 / Display 子系统 / 基础概念

modetest显示彩条
modetest -M rockchip -s 93@64:#1

其中93是一个connector,64是crtc, #1是该crtc下的一个plane(不知道应该是什么专业术语反正可以通过modetest查看,就在crtc条目的下面一行)
切换到i915后启动效果:

关于nouveau和NV驱动能否共存的问题

如何切换到nouveau

Linux

arm启动流程

ARM Linux Boot Sequence
先从arch下的启动文件,再到init下的main.c里面的start_kernel

如何用VSCode插件在linux内核源码中跳转?

How to use the Visual Studio Code to navigate Linux kernel source

AllwinnerH616 Debian Build 如何更改初始package?

其实也适用于任何基于armbian build的项目
路径: Allwinner-H616.bak/external/config/cli/bullseye/main/config_cli_standard
其中bullseye代表了debian版本11,jammy是Ubuntu 2204 focal 是 Ubuntu 2004
然后在packages.additional中添加想要安装的包,记住不要添加错了否则build后会中断下载

RKNN2/RKNPU2


关于驱动更新:
直接把新的librknnrt.so/librknn_api.so放在/usr/lib下面就行

全志H616

H616 Yuzuki SBC

EMAC的问题

  1. GMAC是千兆以太网控制器
  2. MACPHY之间通过RMII/RGMII/MII/GMII 连接
  3. 全志H616的EMAC1是通过直接内部连接到了芯片上集成的一个100M EPHY,所以集成度很高,然后EMAC0 如果要使用得外接PHY芯片(淘宝那种),但是EPHY(EMAC1)需要连接以太网隔离变压器,可能是电平的缘故