0%

最近瞎鼓捣东西形成了一些笔记想好好地汇编成册,当年写论文时用过的LaTeX还不错,基本语法也没忘,于是就选它了。troff据说历史更悠久,而且基本上Linux发行版都会预装,不过就不花功夫研究老古董了。

得益于Archlinux粗壮的大腿,使用Manjaro遇到的问题往往可以在Archlinux Wiki中找到答案。安装很简单:

sudo pacman -Sy texlive-most texlive-langchinese

texlive-most包含了texlive-core和其他一些可选模块,建议全选。texlive-langchinese包含了CTEX宏包。我选择xeLatex + CTEX的中文方案,所以这个包必装。

安装完毕后测试看看效果:

\documentclass{ctexbook}
\begin{document}
中文测试
\end{document}

输出符合预期。texdoc tikz还是一如既往地头大,而且现在又多了一个画花纹的pgfornament看起来很有趣。

参考:安装Manjaro之后的配置

平台还是R3300-M …… 准备用它当做阅读器专心读书,人不在家直接关闭显示器就行了,从外面还能SSH连回来做实验,电费可忽略不计。安装运行Calibre很简单,但是中文字体看起来很奇怪,汇总下网上搜来的解决办法。

安装字体

安装官方仓库中的字体

sudo pacman -S ttf-roboto noto-fonts ttf-dejavu
sudo pacman -S wqy-bitmapfont wqy-microhei wqy-microhei-lite wqy-zenhei
sudo pacman -S noto-fonts-cjk adobe-source-han-sans-cn-fonts adobe-source-han-serif-cn-fonts

上面的ttf-roboto noto-fonts如果系统已经安装了就不需要再装。

创建字体配置文件

/etc/fonts/fonts.conf里面提示不要修改此文件,所以创建~/.config/fontconfig/fonts.conf

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
    <its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
        <its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
    </its:rules>

    <description>Manjaro Font Config</description>

    <!-- Font directory list -->
    <dir>/usr/share/fonts</dir>
    <dir>/usr/local/share/fonts</dir>
    <dir prefix="xdg">fonts</dir>
    <dir>~/.fonts</dir> <!-- this line will be removed in the future -->

    <!-- 自动微调 微调 抗锯齿 内嵌点阵字体 -->
    <match target="font">
        <edit name="autohint"> <bool>false</bool> </edit>
        <edit name="hinting"> <bool>true</bool> </edit>
        <edit name="antialias"> <bool>true</bool> </edit>
        <edit name="embeddedbitmap" mode="assign"> <bool>false</bool> </edit>
    </match>

    <!-- 英文默认字体使用 Roboto 和 Noto Serif ,终端使用 DejaVu Sans Mono. -->
    <match>
        <test qual="any" name="family">
            <string>serif</string>
        </test>
        <edit name="family" mode="prepend" binding="strong">
            <string>Noto Serif</string>
        </edit>
    </match>
    <match target="pattern">
        <test qual="any" name="family">
            <string>sans-serif</string>
        </test>
        <edit name="family" mode="prepend" binding="strong">
            <string>Roboto</string>
        </edit>
    </match>
    <match target="pattern">
        <test qual="any" name="family">
            <string>monospace</string>
        </test>
        <edit name="family" mode="prepend" binding="strong">
            <string>DejaVu Sans Mono</string>
        </edit>
    </match>

    <!-- 中文默认字体使用思源宋体,不使用 Noto Sans CJK SC 是因为这个字体会在特定情况下显示片假字. -->
    <match>
        <test name="lang" compare="contains">
            <string>zh</string>
        </test>
        <test name="family">
            <string>serif</string>
        </test>
        <edit name="family" mode="prepend">
            <string>Source Han Serif CN</string>
        </edit>
    </match>
    <match>
        <test name="lang" compare="contains">
            <string>zh</string>
        </test>
        <test name="family">
            <string>sans-serif</string>
        </test>
        <edit name="family" mode="prepend">
            <string>Source Han Sans CN</string>
        </edit>
    </match>
    <match>
        <test name="lang" compare="contains">
            <string>zh</string>
        </test>
        <test name="family">
            <string>monospace</string>
        </test>
        <edit name="family" mode="prepend">
            <string>Noto Sans Mono CJK SC</string>
        </edit>
    </match>

    <!-- 把Linux没有的中文字体映射到已有字体,这样当这些字体未安装时会有替代字体 -->
    <match target="pattern">
        <test qual="any" name="family">
            <string>SimHei</string>
        </test>
        <edit name="family" mode="assign" binding="same">
            <string>Source Han Sans CN</string>
        </edit>
    </match>
    <match target="pattern">
        <test qual="any" name="family">
            <string>SimSun</string>
        </test>
        <edit name="family" mode="assign" binding="same">
            <string>Source Han Serif CN</string>
        </edit>
    </match>
    <match target="pattern">
        <test qual="any" name="family">
            <string>SimSun-18030</string>
        </test>
        <edit name="family" mode="assign" binding="same">
            <string>Source Han Serif CN</string>
        </edit>
    </match>
    
    <!-- Load local system customization file -->
    <include ignore_missing="yes">conf.d</include>
    <!-- Font cache directory list -->
    <cachedir>/var/cache/fontconfig</cachedir>
    <cachedir prefix="xdg">fontconfig</cachedir>
    <!-- will be removed in the future -->
    <cachedir>~/.fontconfig</cachedir>

    <config>
        <!-- Rescan in every 30s when FcFontSetList is called -->
        <rescan> <int>30</int> </rescan>
    </config>

</fontconfig>

晚上试试看字体是否会正常一些。

更新:经测试,配置字体后使用Calibre-Viewer看书字体渲染效果满意。

手动安装字体

刷新字体命令:fc-cache -fv

Font directories:
        /home/youname/.local/share/fonts
        /usr/local/share/fonts
        /usr/share/fonts
        /home/youname/.fonts
        /usr/share/fonts/TTF
        /usr/share/fonts/adobe-source-code-pro
        /usr/share/fonts/adobe-source-han-sans
        /usr/share/fonts/adobe-source-han-serif
        /usr/share/fonts/cantarell
        /usr/share/fonts/droid
        /usr/share/fonts/encodings
        /usr/share/fonts/gsfonts
        /usr/share/fonts/liberation
        /usr/share/fonts/misc
        /usr/share/fonts/noto
        /usr/share/fonts/noto-cjk
        /usr/share/fonts/util
        /usr/share/fonts/wenquanyi
        /usr/share/fonts/wps-office
        /usr/share/fonts/encodings/large
        /usr/share/fonts/wenquanyi/wqy-microhei
        /usr/share/fonts/wenquanyi/wqy-microhei-lite
        /usr/share/fonts/wenquanyi/wqy-zenhei
/home/youname/.local/share/fonts: skipping, no such directory
/usr/local/share/fonts: skipping, no such directory
/usr/share/fonts: caching, new cache contents: 0 fonts, 15 dirs
/usr/share/fonts/TTF: caching, new cache contents: 148 fonts, 0 dirs
/usr/share/fonts/adobe-source-code-pro: caching, new cache contents: 30 fonts, 0 dirs
/usr/share/fonts/adobe-source-han-sans: caching, new cache contents: 7 fonts, 0 dirs
/usr/share/fonts/adobe-source-han-serif: caching, new cache contents: 7 fonts, 0 dirs
/usr/share/fonts/cantarell: caching, new cache contents: 11 fonts, 0 dirs
/usr/share/fonts/droid: caching, new cache contents: 27 fonts, 0 dirs
/usr/share/fonts/encodings: caching, new cache contents: 0 fonts, 1 dirs
/usr/share/fonts/encodings/large: caching, new cache contents: 0 fonts, 0 dirs
/usr/share/fonts/gsfonts: caching, new cache contents: 35 fonts, 0 dirs
/usr/share/fonts/liberation: caching, new cache contents: 12 fonts, 0 dirs
/usr/share/fonts/misc: caching, new cache contents: 1 fonts, 0 dirs
/usr/share/fonts/noto: caching, new cache contents: 615 fonts, 0 dirs
/usr/share/fonts/noto-cjk: caching, new cache contents: 73 fonts, 0 dirs
/usr/share/fonts/util: caching, new cache contents: 0 fonts, 0 dirs
/usr/share/fonts/wenquanyi: caching, new cache contents: 5 fonts, 3 dirs
/usr/share/fonts/wenquanyi/wqy-microhei: caching, new cache contents: 2 fonts, 0 dirs
/usr/share/fonts/wenquanyi/wqy-microhei-lite: caching, new cache contents: 2 fonts, 0 dirs
/usr/share/fonts/wenquanyi/wqy-zenhei: caching, new cache contents: 3 fonts, 0 dirs
/usr/share/fonts/wps-office: caching, new cache contents: 14 fonts, 0 dirs
/home/youname/.fonts: caching, new cache contents: 0 fonts, 0 dirs
/usr/share/fonts/TTF: skipping, looped directory detected
/usr/share/fonts/adobe-source-code-pro: skipping, looped directory detected
/usr/share/fonts/adobe-source-han-sans: skipping, looped directory detected
/usr/share/fonts/adobe-source-han-serif: skipping, looped directory detected
/usr/share/fonts/cantarell: skipping, looped directory detected
/usr/share/fonts/droid: skipping, looped directory detected
/usr/share/fonts/encodings: skipping, looped directory detected
/usr/share/fonts/gsfonts: skipping, looped directory detected
/usr/share/fonts/liberation: skipping, looped directory detected
/usr/share/fonts/misc: skipping, looped directory detected
/usr/share/fonts/noto: skipping, looped directory detected
/usr/share/fonts/noto-cjk: skipping, looped directory detected
/usr/share/fonts/util: skipping, looped directory detected
/usr/share/fonts/wenquanyi: skipping, looped directory detected
/usr/share/fonts/wps-office: skipping, looped directory detected
/usr/share/fonts/encodings/large: skipping, looped directory detected
/usr/share/fonts/wenquanyi/wqy-microhei: skipping, looped directory detected
/usr/share/fonts/wenquanyi/wqy-microhei-lite: skipping, looped directory detected
/usr/share/fonts/wenquanyi/wqy-zenhei: skipping, looped directory detected
/var/cache/fontconfig: not cleaning unwritable cache directory
/home/youname/.cache/fontconfig: cleaning cache directory
/home/youname/.fontconfig: not cleaning non-existent cache directory
fc-cache: succeeded

查找字体位置一目了然。过去一般习惯把字体文件直接丢到~/.fonts中,但是/etc/fonts/fonts.conf中提到

<!-- the following element will be removed in the future -->
<dir>~/.fonts</dir>

所以还是老实放到/usr/share/fonts/里面合适的目录中更合适。

在前面已经成功驱动了WIFI,于是再来看一看红外线:

$ dmesg | grep meson-ir

[    5.140483] rc rc0: meson-ir as /devices/platform/soc/c8100000.bus/c8100580.ir/rc/rc0
[    5.142659] rc rc0: lirc_dev: driver meson-ir registered at minor = 0, raw IR receiver, no transmitter
[    5.142827] input: meson-ir as /devices/platform/soc/c8100000.bus/c8100580.ir/rc/rc0/input4
[    5.147424] meson-ir c8100580.ir: receiver initialized

看起来红外线模块已经被成功识别并驱动。

再来看一看遥控文件:

$ ls /lib/udev/rc_keymaps/

adstech_dvb_t_pci.toml
af9005.toml
alink_dtu_m.toml
allwinner_ba10_tv_box.toml
allwinner_i12_a20_tv_box.toml
anysee.toml
apac_viewcomp.toml
astrometa_t2hybrid.toml
asus_pc39.toml
asus_ps3_100.toml
ati_tv_wonder_hd_600.toml
ati_x10.toml
avermedia.toml
avermedia_a16d.toml
avermedia_cardbus.toml
avermedia_dvbt.toml
avermedia_m135a.toml
avermedia_m733a_rm_k6.toml
avermedia_rm_ks.toml
avertv_303.toml
az6027.toml
azurewave_ad_tu700.toml
beelink_gs1.toml
behold.toml
behold_columbus.toml
budget_ci_old.toml
cec.toml
cinergy.toml
cinergy_1400.toml
cinergyt2.toml
d680_dmb.toml
delock_61959.toml
dib0700_nec.toml
dib0700_rc5.toml
dibusb.toml
digitalnow_tinytwin.toml
digittrade.toml
digitv.toml
dish_network.toml
dm1105_nec.toml
dntv_live_dvb_t.toml
dntv_live_dvbt_pro.toml
dtt200u.toml
dvbsky.toml
dvico_mce.toml
dvico_portable.toml
em_terratec.toml
encore_enltv.toml
encore_enltv2.toml
encore_enltv_fm53.toml
evga_indtube.toml
eztv.toml
flydvb.toml
flyvideo.toml
fusionhdtv_mce.toml
gadmei_rm008z.toml
geekbox.toml
genius_tvgo_a11mce.toml
gotview7135.toml
haupp.toml
hauppauge.toml
hisi_poplar.toml
hisi_tv_demo.toml
imon_mce.toml
imon_pad.toml
imon_rsc.toml
iodata_bctv7e.toml
it913x_v1.toml
it913x_v2.toml
kaiomy.toml
khadas.toml
kii_pro.toml
kworld_315u.toml
kworld_pc150u.toml
kworld_plus_tv_analog.toml
leadtek_y04g0051.toml
lme2510.toml
manli.toml
mce_keyboard.toml
medion_x10.toml
medion_x10_digitainer.toml
medion_x10_or2x.toml
megasky.toml
msi_digivox_ii.toml
msi_digivox_iii.toml
msi_tvanywhere.toml
msi_tvanywhere_plus.toml
nebula.toml
nec_terratec_cinergy_xs.toml
norwood.toml
npgtech.toml
odroid.toml
opera1.toml
pctv_sedna.toml
pinnacle310e.toml
pinnacle_color.toml
pinnacle_grey.toml
pinnacle_pctv_hd.toml
pixelview.toml
pixelview_002t.toml
pixelview_mk12.toml
pixelview_new.toml
powercolor_real_angel.toml
proteus_2309.toml
purpletv.toml
pv951.toml
rc6_mce.toml
real_audio_220_32_keys.toml
reddo.toml
snapstream_firefly.toml
streamzap.toml
su3000.toml
tango.toml
tanix_tx3mini.toml
tanix_tx5max.toml
tbs_nec.toml
technisat_ts35.toml
technisat_usb2.toml
terratec_cinergy_c_pci.toml
terratec_cinergy_s2_hd.toml
terratec_cinergy_xs.toml
terratec_slim.toml
terratec_slim_2.toml
tevii_nec.toml
tivo.toml
total_media_in_hand.toml
total_media_in_hand_02.toml
trekstor.toml
tt_1500.toml
tvwalkertwin.toml
twinhan_dtv_cab_ci.toml
twinhan_vp1027_dvbs.toml
vega_s9x.toml
videomate_k100.toml
videomate_s350.toml
videomate_tv_pvr.toml
vp702x.toml
wetek_hub.toml
wetek_play2.toml
winfast.toml
winfast_usbii_deluxe.toml
wobo_i5.toml
x96max.toml
xbox_dvd.toml
zx_irdec.toml

有很多,但显然没有我使用的遥控器。计划找出按键对应值,然后根据模板创建。寻找按键映射参照 https://discourse.coreelec.org/t/how-to-configure-ir-remote-control/31 ,我之前做过Coreelec的,不知道是否可以直接照抄。(此部分待补充)

创建遥控文件后,可以利用按键调用系统命令,比如执行某个脚本,或者重启等等。参考 https://forum.armbian.com/topic/11161-lirc-on-armbian-buster/ ,作者使用triggerhappy实现功能:

# Samsung TV Remote Control
KEY_RED     1   /usr/local/bin/script.sh red
KEY_GREEN   1   /usr/local/bin/script.sh green
KEY_YELLOW  1   /usr/local/bin/script.sh yellow
KEY_BLUE    1   /usr/local/bin/script.sh blue

triggerhappy使用yay可以安装,有空测试下。

硬件平台还是R3300-M …… 想要Firefly的Station P2,不过迫于没钱,继续折腾小红盒 XD

前言

WIFI设置好后,又动了折腾图形界面的心思。之前测试过XFCE,分辨率不正常,桌面拖动窗口有明显卡顿,打开firefox直接卡死。一则显卡驱动有问题,二则XFCE对于R3300-M还是太重了。于是换用wayland + sway方案,彻底放弃X11。显卡驱动选择Lima,已经集成在了mesa软件包中。如果选择尝鲜,也可以安装mesa-git。Lima是在反向官方驱动的基础上,由社区开发维护的开源驱动,对Mali-400Mali-450提供支持。详情可以在 https://docs.mesa3d.org/drivers/lima.html 查看。感谢Luc Verhaegen和Qiang Yu的开创性工作。

镜像

参见 https://manjaro.org/download/#khadas-vim-2-sway ,下载地址

https://github.com/manjaro-arm/vim2-images/releases/download/21.08/Manjaro-ARM-sway-vim2-21.08.img.xz
https://github.com/manjaro-arm/vim2-images/releases/download/21.08/Manjaro-ARM-sway-vim2-21.08.img.xz.torrent

安装

烧录镜像、修改u-boot.ext、修改extlinux等与之前无异。

配置

第一次启动会进入配置引导程序,配置结束后重启,进入sway图形界面。在开始探索之前,先修复系统的小小bug:

修复greetd服务

打开/etc/greetd/config.toml,看起来大概这样:

[terminal]
# The VT to run the greeter on. Can be "next", "current" or a number
# designating the VT.
vt = 1

# The default session, also known as the greeter.
[default_session]
# `agreety` is the bundled agetty/login-lookalike. You can replace `$SHELL`
# with whatever you want started, such as `sway`.
command = "sway --config /etc/greetd/sway"

# The user to run the command as. The privileges this user must have depends
# on the greeter. A graphical greeter may for example require the user to be
# in the `video` group.
user = "greeter"
[initial_session]
command = "sway --config /etc/greetd/oem-setup"
user = "oem"

你需要将最后一行的oem修改为自己实际的用户名。 Manjaro ARM团队提到将[initial_session]部分完整删除(即删除上面配置文件最后三行),此问题预计很快会得到修复。

这一步本应由配置程序自动完成,如果忘记修改,下次启动将无法进入图形界面。这种情况下,按下Ctrl + Alt + F2进入tty2,手动修改过来就可以了。

同步时间

直接摘抄之前的文章:

user $ timedatectl set-ntp true
user $ sudo systemctl enable --now systemd-timesyncd

时间不准会造成SSL验证失败等一系列问题。

换国内源

sudo pacman-mirrors -i -c China -m rank
sudo pacman-mirrors -g
sudo pacman -Syyu

使用

文档获取

sway作为窗口管理器(window manager)提供了轻量的图形功能,大量依赖配置文件和快捷键操作。遵循linux传统,/etc/sway/config~/.config/sway/config各存在一份,前者全局,后者本地优先。另外桌面右上角的问号是入门操作文档,没接触过i3sway的用户必读。sway虽然轻量,但是仍然提供了丰富好用的功能,类似全屏、窗口、区域截图或录制功能均有对应快捷键,不逊色于macOS。

查看glxinfo输出

glxinfo由mesa-demos提供:

sudo pacman -S mesa-demos

然后执行glxinfo -B

name of display: :0
display: :0  screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
    Vendor: lima (0x13b5)
    Device: Mali450 (0xffffffff)
    Version: 21.1.6
    Accelerated: yes
    Video memory: 0MB
    Unified memory: yes
    Preferred profile: compat (0x2)
    Max core profile version: 0.0
    Max compat profile version: 2.1
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 2.0
OpenGL vendor string: lima
OpenGL renderer string: Mali450
OpenGL version string: 2.1 Mesa 21.1.6
OpenGL shading language version string: 1.20

OpenGL ES profile version string: OpenGL ES 2.0 Mesa 21.1.6
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 1.0.16

显卡驱动正常。另外执行sensors可以看系统温度,负载一高很容易达到50-60°C,有必要考虑强化散热。

HiDPI设置

这部分可以参阅Archlinux:https://wiki.archlinux.org/title/Sway

我使用的某品牌2K分辨率,默认分辨率看起来很正常,实际也是如此:

$ swaymsg -t get_outputs
Output HDMI-A-1 'Unknown Q27D530VHP 0x00000000' (focused)
  Current mode: 2560x1440 @ 59.951 Hz
  Position: 0,0
  Scale factor: 1.000000
  Scale filter: nearest
  Subpixel hinting: unknown
  Transform: normal
  Workspace: 1
  Max render time: off
  Adaptive sync: disabled
  Available modes:
    640x480 @ 72.809 Hz
    640x480 @ 75.000 Hz
    720x480 @ 59.940 Hz
    800x600 @ 60.317 Hz    
    800x600 @ 72.188 Hz
    800x600 @ 75.000 Hz
    1024x768 @ 60.004 Hz
    1024x768 @ 70.069 Hz
    1024x768 @ 75.029 Hz
    1280x720 @ 59.940 Hz
    1280x720 @ 60.000 Hz
    1280x800 @ 59.910 Hz
    1366x768 @ 59.964 Hz
    1280x1024 @ 60.020 Hz
    1280x1024 @ 75.025 Hz
    1600x900 @ 60.000 Hz
    1680x1050 @ 59.883 Hz
    1920x1080 @ 59.940 Hz
    1920x1080 @ 60.000 Hz
    1920x1080 @ 60.000 Hz
    1920x1200 @ 59.950 Hz
    2560x1440 @ 59.951 Hz

执行glxgears可以调出一个齿轮画面测试FPS,R3300-M稳定在34~35之间。电脑上这个值一般都是三位数,不过对于盒子而言已经很不错了。

2K分辨率下文字有点小,缩放到1.5:

swaymsg output HDMI-A-1 scale 1.5

这样看起来好了很多。

输入法安装

sudo pacman -S fcitx5-im #安装所有
sudo pacman -S fcitx5-chinese-addons    

然后打开/etc/environment添加参数:

GTK_IM_MODULE=fcitx
QT_IM_MODULE=fcitx
XMODIFIERS=@im=fcitx

最后在Fcitx 5 Configuration中,删除默认的Default Group,新建一个Chinese组,Keyboard-Chinese放上面,Pinyin放下面就万事大吉。默认输入法英文,使用Ctrl SpaceCtrl ShiftLeft Shift在中英文之间来回切换。除了候选框小一点没别的问题。

杂项

自带的firefox刷个论坛还是很舒服的,测试bilibili弹幕比较卡,而且会丢帧,看视频还是重启到安卓系统吧。libreoffice,gedit等用着很流畅。目前小红盒用来写hexo博客或者看PDF很安逸。

另外电源管理有点小问题,关机会直接重启。而且有时休眠后显示器点不亮,需要重新拔插HDMI。

换新电脑后利用git直接拉取的代码不是完整的hexo环境,缺失了node_modules(参见.gitignore)和主题(如果使用git clone 安装了第三方主题)。

恢复node_modules

随便新建一个文件夹,进入后执行hexo init,完成后把node_modules移动到刚才的hexo目录中。

安装主题

next为例,在hexo目录下执行git clone https://github.com/theme-next/hexo-theme-next themes/next。如果之前在hexo根目录下使用了 _config.next.yml进行配置,那么就不需要重新配置主题,推荐这种配置方式。

解决 TypeError: line.matchAll is not a function 问题

_config.yml中,将hightlight一段中enable字段由true修改为false即可。

测试测试

本文主要参考自[Wiki] How to contribute to Manjaro ARM

编译平台

运行Manjaro的x86_64或aarch64设备,需要安装Manjaro-arm-tools。鉴于R3300-M已经运行了Manjaro ARM 21.08,所以以下用盒子制作盒子镜像。

sudo pacman -S manjaro-arm-tools

获取配置文件

sudo getarmprofiles -f

修改配置文件

manjaro-arm-tool会从服务器下载现成的rootfs压缩包(大概160MB),然后以此为基础根据配置文件进行额外的包安装及配置,最终生成压缩镜像。笔者以vim2为模板进行修改:

  1. 进入配置文件目录:/usr/share/manjaro-arm-tools/profiles/arm-profiles/devices

  2. 复制vim2配置文件:cp vim2 vim2m

  3. 修改vim2m:

## Maintained by Spikerguy ##

# Kernel and bootloader stuff
linux-aml
boot-vim2
plymouth
plymouth-theme-manjaro

# Video driver

# Other device specific packages
crda
btrfs-progs
#bluetooth-vim3
#khadas-utils
fbset
#kvim1-firmware
#kvim2-firmware
#ap6398s-firmware
vim2-post-install

最主要的修改是把内核从linux换成了linux-aml,之前实测过5.13版本主线内核无法启动R3300-M,linux-aml正常。其他几个固件估计R3300-M也用不上,故注释掉。

  1. 生成镜像
sudo buildarmimg -d vim2m -e minimal -v 21.08 -n

基本参数解释:

Usage: buildarmimg [options]
    -d <device>        Device the image is for. [Default = rpi4. Options = oc2, on2, on2-plus, pbpro, pine64, pine64-lts, pinebook, pinephone, pinetab, rock64, rockpi4, rockpro64, rpi3, rpi4, vim1, vim2, vim3]
    -e <edition>       Edition of the image. [Default = minimal. Options = cubocore, gnome, i3, kde-plasma, lxqt, mate, minimal, plasma-mobile, server, wayfire, xfce]
    -v <version>       Define the version the resulting image should be named. [Default is current YY.MM]
    -i <package>       Install local package into image rootfs.
    -b <branch>        Set the branch used in the image. [Default = stable. Options = stable, testing or unstable]
    -n                 Force download of new rootfs.
    -x                 Don't compress the image.
    -h                 This help

本例用刚才制作的vim2m配置文件生成了minimal镜像。

生成镜像不会耗时很多,因为涉及的主要是打包和镜像构建,不需要从源码开始编译。我这里测试是16.58分钟,建议优化网络否则下载Manjaro-ARM-aarch64-latest.tar.gz(约160M)这一步会耗时很久。

  1. 复制镜像到电脑

进入镜像目录:cd /var/cache/manjaro-arm-tools/img

复制镜像到本地家目录:scp Manjaro-ARM-minimal-vim2m-2108img.xz tccmu@192.168.1.221:/home/tccmu

tccmu是电脑上当前用户名,替换成自己的即可。192.168.1.221是自己电脑的IP(不是盒子),同样要替换。

  1. 写入镜像到TF卡:
    xz -dc Manjaro-ARM-minimal-vim2m-2108.img.xz | dd of=/dev/sdX bs=1M status=progress conv=fsync
    
    写入设备名自己替换。

之后的配置没有任何难度了,修改extlinux.conf使用合适dtb,修改u-boot-s905为u-boot.ext就完事大吉。

备注

目前镜像已生成完毕,但未经实机测试。

更新

测试生成的镜像无法启动,连u-boot都进不去,直接进入盒子安卓系统的recovery。怀疑是rootfs包下载错误问题。

另外最新发布的21.08经测试可以正常启动运行,其搭载的主线内核 5.13.12-1-MANJARO-ARM #1 SMP Wed Aug 18 07:36:58 UTC 2021 aarch64 GNU/Linux一切正常,所以替换aml内核貌似就没必要了。

部分linux发行版网络配置GUI强制openconnect使用密钥,用户名-密码登录可以通过命令行实现:

sudo openconnect [域名或IP地址]:[端口号]

然后根据提示操作就可以了。

主要来源:在 Manjaro Linux 系统使用 Docker

提要

硬件平台还是百视通R3300-M …… 安装Manjaro Arm 21.04后已升级到21.08,内核版本 5.13.0-1-MANJARO-ARM #1 SMP PREEMPT Wed Jun 30 23:07:51 +03 2021 aarch64 GNU/Linux

安装Docker

sudo pacman -Syu
sudo pacman -S docker

启动服务

sudo systemctl start docker.service

添加到系统启动项

sudo systemctl enable docker.service

添加当前用户到Docker组

这样当前用户就有足够权限操作docker而不必sudo权限。

sudo usermod -aG docker $USER

换国内源

打开或创建 /etc/docker/daemon.json 文件:

{
    "registry-mirrors": [
        "https://registry.docker-cn.com"
    ]
}

registry.docker-cn.com 是 Docker 的官方中国镜像, 除此之外还有其他一些第三方镜像可选:

镜像 地址
Azure中国 https://dockerhub.azk8s.cn
中科大 https://docker.mirrors.ustc.edu.cn
七牛云 https://reg-mirror.qiniu.com
网易云 https://hub-mirror.c.163.com
腾讯云 https://mirror.ccs.tencentyun.com

保存文件之后重启一下 Docker 服务:

sudo systemctl daemon-reload
sudo systemctl restart docker

其他操作

docker search redis
docker pull redis
docker pull redis:rc
docker images
docker run --name myredis -d redis
docker ps
docker stop myredis
docker rm myredis
docker info

安装Portainer CE

docker volume create portainer_data
docker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce

下步计划

之前在docker里运行过dokuwiki,tiddlywiki,minecraft server等等。跑minecraft server性能不太行,破坏方块有明显卡顿。

生成密钥及配置(略)

网上教程有很多

生成站点并推送到github

hexo g -d

推送站点源码到github

.DS_Store
Thumbs.db
db.json
*.log
node_modules/
public/
git add .
git commit -m 'hexo 源文件推送'
git push origin hexoSource

远程分支名用自己的

拉取源码到本地

git clone -b blogSource https://github.com/12321/12321.github.io.git