分类 计算机 下的文章

[备忘]个人Windows10下办公必备软件列表

个人常用软件列表,方便自己重装系统,如有转载,请注明出处。

———— by realasking

Alexandra Reader:一些英语小说集合

Avogadro:画分子结构图

Bandizip:比较干净的解压软件

Bing Wallpaper: 微软官方的壁纸工具

Blumind:思维导图编辑器

ColorVeil: 一个免费的可自定义颜色的屏幕色彩滤镜,大量编辑word文档或上网时,打开它可以减轻视疲劳。

两台电脑上的设置为暖屏 #95B47E, 47%冷屏 #738631,39%

Cp1:屏幕拾色器

CTex或Texlive:Latex文档编辑环境

DuktoR6:局域网文件互传

Emacs:文本编辑器

Everything:搜索工具

FastCopy:快速复制工具

flameshot:截图工具

Foobar2000:音乐播放器

geek:彻底卸载软件

GIMP:图像处理软件

Goldendict:词典

Ghostscript:Scribus和Latex需要的东西

Joplin:个人云笔记工具

KeePassXC:密码管理工具

LLVM:Emacs的插件进行C语言格式化需要

maxima-5.41.0a:推公式

Mendeley:文献管理

Noteexpress:之前使用的文献管理

Microsoft Edge:浏览器

Office:办公软件

MobaXterm:很好的ssh和Xserver工具

Msys2:Emacs的irony扩展需要

Nextcloud客户端:网盘

nomacs:看图软件

Octave-4.4.1:数值计算软件

Ovito-3.0.0-dev481:一个还能支持脚本的3.0系列的免费版本,分子模拟可视化工具

Potplayer:视频播放器

PTCLab:马氏体相变取向关系相关软件

python-3.7.7:python环境,使用此版本因为和自己的Emacs配置匹配,不想多折腾

QTranslate:多引擎网络聚合翻译工具

Racipro:SAED衍射斑点模拟

Rawtherapee:处理Raw格式照片工具

Scribus:一个排版工具

Typora:Markdown编辑器

Visit:VTK文件可视化工具

VMD:分子模拟可视化工具

金山PDF独立版:免费;支持换背景色且不影响图片颜色;比全套WPS干净

京东读书:很好的看书工具,不过买书有点贵

万能科学计算器:计算器

小狼毫输入法:RIME输入法框架Windows版,不过和ColorVeil配合会闪烁,问题不大

元素:周期表:一个化学元素周期表

易呗背单词:背单词

越飞阅读:没有配置好Emacs时的阅读工具,配置好后就不怎么用了

然后python中至少要安装的包有:
autopep8 black Cython flake8 ipython jedi numpy pandas pyflakes rope regex scipy statsmodels yapf matplotlib shapely

[笔记]中国移动光宽带用户下载Github项目中releases压缩包的办法

个人笔记,如有转载,请注明出处。

——by realasking

我家用的中国移动送的移动光宽带,以前在家干活儿时间少,没有觉得有啥不便,最近因为疫情问题,没有出家门,终于觉得移动光宽带上某些站点实在难以忍受了。

最近一段时间,用移动光宽带下载Github上的项目的releases包和更新AUR里的很多包,速度都慢到令人发指。上午8点到10点,下午2点到4点稍快,能达到50KiB/s,其它时候都在7~8KiB/s,而且关键是,如果挂在那里不管,下载一段时间后就会中断。Github的东西又不能续传,更新几次VTKLAMMPS等等简直要了老命了。百度网盘的离线下载就是废物,技术水平可能太水了,尽管买了超级会员,离线下载的时候总是资源不存在。

好在经过一番搜索,找到了解决的办法,直接用微软账号登录offcloud.com,然后把链接拷贝到页面上的对话框,什么都不用再改,直接回车,就能开始顺利下载了,下载速度基本上保持在120KiB/s~2MiB/s,也没中断,很好了。只是AUR的更新就得手动完成,不过这也不算麻烦,可以将就用着了。

[原创]无光线传感器笔记本上自动调整亮度的设置

2020-03-03:补充和clight作者交流后得知的扩充功能的方法

2020-02-21:创建文章

本文章中的操作为原创内容,适用于Manjaro Linux和Microsoft Windows 10,其余环境未作尝试,软件从网上获得。本文如有转载,请注明出处。
——by realasking

最近一直写东西,眼睛有些受不了,但是自己的电脑都没有光线传感器,亮度得不断调整,为了解决这个问题,就在网上搜索了一下,在Manjaro和Win10上分别找到了实现办法,记录如下:

使用Manjaro Linux的联想小新潮7000笔记本实现应用摄像头测光的屏幕亮度自动调整

安装clight和clightd

yaourt -S clight-git clightd-git

clight的配置

该软件安装之后,重启计算机服务就会自动打开,但是默认调光是线性的,没有考虑到两个问题:
1.人的视觉感受不是线性的
2.光线强到一定程度发生溢出之后的所有量化值都一样了
所以需要我们重新配置
该软件配置文件位置在:

/etc/default/clight.conf

根据说明,我调整了这几项:

#调光步长
backlight_trans_step = 0.05;
#图片亮度取值为[0,1],然后分成11个刻度,每个刻度对应屏幕约化亮度
ac_backlight_regression_points = [ 0.0, 0.082, 0.133, 0.2046, 0.2758, 0.33, 0.385, 0.408, 0.52, 0.69, 1.0 ];
batt_backlight_regression_points = [ 0.0, 0.08, 0.128, 0.19, 0.25, 0.297, 0.338, 0.35, 0.44, 0.57, 0.80 ];
#用5帧的结果调光
captures = 5;
#北京的经纬度
latitude = 39.9;
longitude = 116.5;

两组对应亮度的参数我均以最近白天靠阳台房间窗口背光处笔记本云很少的时候的笔记本适合我的感观的亮度作为基准,对应于第7,8个数字,其余部分尽量平滑的变化到最大值和最小值,然后再根据自己的感受做了一定调整。高亮度部分不如低亮度部分可靠,对应的点太少。
使用中感觉要好了不少,但是在夜间,有时测光后亮度会非常亮,这种感觉不好,尚不知原因。

创建clight个人模块,增加夜间停用自动调光功能

夜间有时自动调光亮度过亮,不知道原因,但win下没有这问题,经过和作者交流(夜间停用调光),得知可以通过创建个人模块的办法来解决,做法是:

创建一个c语言模块文件

比如叫a.c。
我所用的模块是将作者回复我的内容稍作修改实现的。我加上夜间先调光的内容,将夜间的亮度先设置为0.16,然后再关闭。

编译为模块

gcc -shared -fPIC a.c -o NightOFF -Wno-unused

然后拷贝到:

a="~/.local/share/clight/modules.d"
mkdir "$a" && cp NightOFF "$a"

详情见自定义模块

然后重启就好了。
该软件作者非常热情,回复很积极,很开心。

Windows 10下用摄像头测光并调整亮度的办法

软件的选择

Windows下曾经有多个软件可以实现这样的功能,然而,现在已经不容易找到了,经过反复搜索,找到了BLUntrl和SoftonEyes这两个还能下载使用的软件。然而,这两个软件均不能自己设定调光频率而且摄像头持续开启,其中BLUntrl还需要结合nircmd才能使用,会导致不断弹窗。
不过摄像头的开闭可以通过打开关闭程序来实现,所以最终选择使用SoftonEyes。

软件安装

解压SoftonEyes到D:\Tools\SoftonEyes,用choco安装AutoHotKeys和AutoHotKeys compiler

软件配置

建立AdjustBrightness.ahk,内容如下:

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
Loop
{
   Run, D:\Tools\SoftonEyes.exe
     Sleep, 10000
   Run, taskkill /im SoftonEyes* /F,,Hide
     Sleep, 1800000
}
Return

编译该文件,然后把快捷方式加入开机运行即可。

【笔记】在联想小新潮7000-15ARR+Manjaro Linux使用pyopencl和amd开源显卡驱动的安装配置

个人笔记,如有转载,请注明出处。
——by realasking


众所周知,amdgpu开源驱动的opengl硬件加速性能比amdgpu-pro闭源显卡更好,但其通过mesa实现的opencl只能支持到1.1版,而且并不总能正常的工作。如果能在开源显卡驱动的基础上安装闭源驱动中的opencl支持,显然是非常好的事情。好在AUR中就提供有这样的方案。

安装

yaourt -S opencl-amd ocl-icd opencl-headers clinfo pyopencl-headers python-pyopencl

检查


[[email protected] ~]$ clinfo 
Number of platforms                               2
  Platform Name                                   AMD Accelerated Parallel Processing
  Platform Vendor                                 Advanced Micro Devices, Inc.
  Platform Version                                OpenCL 2.1 AMD-APP (2906.7)
  Platform Profile                                FULL_PROFILE
  Platform Extensions                             cl_khr_icd cl_amd_event_callback cl_amd_offline_devices 
  Platform Host timer resolution                  1ns
  Platform Extensions function suffix             AMD

Platform Name                                   AMD Accelerated Parallel Processing
  Platform Vendor                                 Advanced Micro Devices, Inc.
  Platform Version                                OpenCL 2.1 AMD-APP (2906.7)
  Platform Profile                                FULL_PROFILE
  Platform Extensions                             cl_khr_icd cl_amd_event_callback cl_amd_offline_devices 
  Platform Host timer resolution                  1ns
  Platform Extensions function suffix             AMD

Platform Name                                   AMD Accelerated Parallel Processing
Number of devices                                 1
  Device Name                                     gfx804
  Device Vendor                                   Advanced Micro Devices, Inc.
  Device Vendor ID                                0x1002
  Device Version                                  OpenCL 1.2 AMD-APP (2906.7)
  Driver Version                                  2906.7
  Device OpenCL C Version                         OpenCL C 1.2 
  Device Type                                     GPU
  Device Board Name (AMD)                         Radeon 500 Series
  Device Topology (AMD)                           PCI-E, 01:00.0
  Device Profile                                  FULL_PROFILE
  Device Available                                Yes
  Compiler Available                              Yes
  Linker Available                                Yes
  Max compute units                               8
  SIMD per compute unit (AMD)                     4
  SIMD width (AMD)                                16
  SIMD instruction width (AMD)                    1
  Max clock frequency                             1124MHz
  Graphics IP (AMD)                               8.0
  Device Partition                                (core)
    Max number of sub-devices                     8
    Supported partition types                     None
    Supported affinity domains                    (n/a)
  Max work item dimensions                        3
  Max work item sizes                             1024x1024x1024
  Max work group size                             256
  Preferred work group size (AMD)                 256
  Max work group size (AMD)                       1024
  Preferred work group size multiple              64
  Wavefront width (AMD)                           64
  Preferred / native vector sizes
char 4 / 4
short 2 / 2
int 1 / 1
long 1 / 1
half 1 / 1 (cl_khr_fp16) float 1 / 1
double 1 / 1 (cl_khr_fp64) Half-precision Floating-point support (cl_khr_fp16) Denormals No Infinity and NANs No Round to nearest No Round to zero No Round to infinity No IEEE754-2008 fused multiply-add No Support is emulated in software No Single-precision Floating-point support (core) Denormals No Infinity and NANs Yes Round to nearest Yes Round to zero Yes Round to infinity Yes IEEE754-2008 fused multiply-add Yes Support is emulated in software No Correctly-rounded divide and sqrt operations Yes Double-precision Floating-point support (cl_khr_fp64) Denormals Yes Infinity and NANs Yes Round to nearest Yes Round to zero Yes Round to infinity Yes IEEE754-2008 fused multiply-add Yes Support is emulated in software No Address bits 64, Little-Endian Global memory size 2141634560 (1.995GiB) Global free memory (AMD) 2071608 (1.976GiB) Global memory channels (AMD) 2 Global memory banks per channel (AMD) 16 Global memory bank width (AMD) 256 bytes Error Correction support No Max memory allocation 1596849766 (1.487GiB) Unified memory for Host and Device No Minimum alignment for any data type 128 bytes Alignment of base address 2048 bits (256 bytes) Global Memory cache type Read/Write Global Memory cache size 16384 (16KiB) Global Memory cache line size 64 bytes Image support Yes Max number of samplers per kernel 16 Max size for 1D images from buffer 134217728 pixels Max 1D or 2D image array size 2048 images Base address alignment for 2D image buffers 256 bytes Pitch alignment for 2D image buffers 256 pixels Max 2D image size 16384x16384 pixels Max 3D image size 2048x2048x2048 pixels Max number of read image args 128 Max number of write image args 8 Local memory type Local Local memory size 32768 (32KiB) Local memory syze per CU (AMD) 65536 (64KiB) Local memory banks (AMD) 32 Max number of constant args 8 Max constant buffer size 1596849766 (1.487GiB) Preferred constant buffer size (AMD) 16384 (16KiB) Max size of kernel argument 1024 Queue properties
Out-of-order execution No Profiling Yes Prefer user sync for interop Yes Profiling timer resolution 1ns Profiling timer offset since Epoch (AMD) 1580776646713521172ns (Tue Feb 4 08:37:26 2020) Execution capabilities
Run OpenCL kernels Yes Run native kernels No Thread trace supported (AMD) Yes Number of async queues (AMD) 2 Max real-time compute queues (AMD) 0 Max real-time compute units (AMD) 0 SPIR versions 1.2 printf() buffer size 4194304 (4MiB) Built-in kernels (n/a) Device Extensions cl_khr_fp64 cl_amd_fp64 cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_3d_image_writes cl_khr_byte_addressable_store cl_khr_fp16 cl_khr_gl_sharing cl_amd_device_attribute_query cl_amd_vec3 cl_amd_printf cl_amd_media_ops cl_amd_media_ops2 cl_amd_popcnt cl_khr_image2d_from_buffer cl_amd_bus_addressable_memory cl_khr_spir cl_khr_gl_event Platform Name AMD Accelerated Parallel Processing Number of devices 1 Device Name gfx902 Device Vendor Advanced Micro Devices, Inc. Device Vendor ID 0x1002 Device Version OpenCL 2.0 AMD-APP (2906.7) Driver Version 2906.7 (PAL,HSAIL) Device OpenCL C Version OpenCL C 2.0 Device Type GPU Device Board Name (AMD) Unknown AMD GPU Device Topology (AMD) PCI-E, 05:00.0 Device Profile FULL_PROFILE Device Available Yes Compiler Available Yes Linker Available Yes Max compute units 8 SIMD per compute unit (AMD) 4 SIMD width (AMD) 16 SIMD instruction width (AMD) 1 Max clock frequency 1100MHz Graphics IP (AMD) 9.2 Device Partition (core) Max number of sub-devices 8 Supported partition types None Supported affinity domains (n/a) Max work item dimensions 3 Max work item sizes 1024x1024x1024 Max work group size 256 Preferred work group size (AMD) 256 Max work group size (AMD) 1024 Preferred work group size multiple 64 Wavefront width (AMD) 64 Preferred / native vector sizes
char 4 / 4
short 2 / 2
int 1 / 1
long 1 / 1
half 1 / 1 (cl_khr_fp16) float 1 / 1
double 1 / 1 (cl_khr_fp64) Half-precision Floating-point support (cl_khr_fp16) Denormals No Infinity and NANs No Round to nearest No Round to zero No Round to infinity No IEEE754-2008 fused multiply-add No Support is emulated in software No Single-precision Floating-point support (core) Denormals No Infinity and NANs Yes Round to nearest Yes Round to zero Yes Round to infinity Yes IEEE754-2008 fused multiply-add Yes Support is emulated in software No Correctly-rounded divide and sqrt operations Yes Double-precision Floating-point support (cl_khr_fp64) Denormals Yes Infinity and NANs Yes Round to nearest Yes Round to zero Yes Round to infinity Yes IEEE754-2008 fused multiply-add Yes Support is emulated in software No Address bits 64, Little-Endian Global memory size 2684354560 (2.5GiB) Global free memory (AMD) 2553760 (2.435GiB) Global memory channels (AMD) 4 Global memory banks per channel (AMD) 4 Global memory bank width (AMD) 256 bytes Error Correction support No Max memory allocation 912680550 (870.4MiB) Unified memory for Host and Device Yes Shared Virtual Memory (SVM) capabilities (core) Coarse-grained buffer sharing Yes Fine-grained buffer sharing Yes Fine-grained system sharing No Atomics No Minimum alignment for any data type 128 bytes Alignment of base address 2048 bits (256 bytes) Preferred alignment for atomics
SVM 0 bytes Global 0 bytes Local 0 bytes Max size for global variable 821412352 (783.4MiB) Preferred total size of global vars 2684354560 (2.5GiB) Global Memory cache type Read/Write Global Memory cache size 16384 (16KiB) Global Memory cache line size 64 bytes Image support Yes Max number of samplers per kernel 16 Max size for 1D images from buffer 134217728 pixels Max 1D or 2D image array size 2048 images Base address alignment for 2D image buffers 256 bytes Pitch alignment for 2D image buffers 256 pixels Max 2D image size 16384x16384 pixels Max 3D image size 2048x2048x2048 pixels Max number of read image args 128 Max number of write image args 64 Max number of read/write image args 64 Max number of pipe args 16 Max active pipe reservations 16 Max pipe packet size 912680550 (870.4MiB) Local memory type Local Local memory size 65536 (64KiB) Local memory syze per CU (AMD) 65536 (64KiB) Local memory banks (AMD) 32 Max number of constant args 8 Max constant buffer size 912680550 (870.4MiB) Preferred constant buffer size (AMD) 16384 (16KiB) Max size of kernel argument 1024 Queue properties (on host)
Out-of-order execution No Profiling Yes Queue properties (on device)
Out-of-order execution Yes Profiling Yes Preferred size 262144 (256KiB) Max size 8388608 (8MiB) Max queues on device 1 Max events on device 1024 Prefer user sync for interop Yes Number of P2P devices (AMD) 0 P2P devices (AMD) (n/a) Profiling timer resolution 1ns Profiling timer offset since Epoch (AMD) 1580776646713519545ns (Tue Feb 4 08:37:26 2020) Execution capabilities
Run OpenCL kernels Yes Run native kernels No Thread trace supported (AMD) Yes Number of async queues (AMD) 4 Max real-time compute queues (AMD) 0 Max real-time compute units (AMD) 0 SPIR versions 1.2 printf() buffer size 4194304 (4MiB) Built-in kernels (n/a) Device Extensions cl_khr_fp64 cl_amd_fp64 cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_3d_image_writes cl_khr_byte_addressable_store cl_khr_fp16 cl_khr_gl_sharing cl_khr_gl_depth_images cl_amd_device_attribute_query cl_amd_vec3 cl_amd_printf cl_amd_media_ops cl_amd_media_ops2 cl_amd_popcnt cl_khr_image2d_from_buffer cl_khr_spir cl_khr_subgroups cl_khr_gl_event cl_khr_depth_images cl_khr_mipmap_image cl_khr_mipmap_image_writes cl_amd_copy_buffer_p2p NULL platform behavior clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...) AMD Accelerated Parallel Processing clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...) Success [AMD] clCreateContext(NULL, ...) [default] Success [AMD] clCreateContext(NULL, ...) [other] Success [AMD] clCreateContextFromType(NULL, CL_DEVICE_TYPE_DEFAULT) Success (1) Platform Name AMD Accelerated Parallel Processing Device Name gfx804 clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU) No devices found in platform clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU) Success (1) Platform Name AMD Accelerated Parallel Processing Device Name gfx804 clCreateContextFromType(NULL, CL_DEVICE_TYPE_ACCELERATOR) No devices found in platform clCreateContextFromType(NULL, CL_DEVICE_TYPE_CUSTOM) No devices found in platform clCreateContextFromType(NULL, CL_DEVICE_TYPE_ALL) Success (1) Platform Name AMD Accelerated Parallel Processing Device Name gfx804 ICD loader properties ICD loader Name OpenCL ICD Loader ICD loader Vendor OCL Icd free software ICD loader Version 2.2.12 ICD loader Profile OpenCL 2.2

切换显卡

使用环境变量PYOPENCL_CTX='0''1'

【笔记】使用refind引导的Manjaro和Win10双启动的Secure Boot配置

个人操作笔记,转载请注明出处。

——by realasking

最近,不知什么原因,导致更新系统后grub-fedora这个能支持中文的grub引导器不能正常工作了,只要使用更新的内核,就提示UUID错误,无论是休眠还是根的都找不到,无论用USB Live启动重装grub还是直接在系统中通过重装grub-fedora这个包,都如此。而将其更换为标准的grub则会在启动时提示找不到一个中文的组件,仔细检查也未能找到原因。为了节约时间,决定更换一个启动器。

refind的安装

pacman -S refind-efi refind-drivers refind-theme-maia
refind-install

配置文件

位置在:/boot/efi/EFI/refind/refind.conf

内容为:

timeout 20
resolution 1920 1080
use_graphics_for linux,windows
#确保使用自定义的,才能保证内核参数的传递
scanfor manual,external
#禁止扫描一些多余、重复的内容
dont_scan_dirs boot,EFI/Manjaro,EFI/Boot
menuentry "Manjaro Linux" {
    #manjaro图片是从maia主题中拷贝过去的
    icon EFI/refind/icons/os_manjaro.png
    #volume后面跟的是part guid
    volume 0b6e08ea-62b7-4ba1-9c41-4ba41a6ec29f
    loader /boot/vmlinuz-4.19-x86_64
    initrd /boot/initramfs-4.19-x86_64.img
    #preload的initrd,如amd-ucode等,需要添加在options的最后,空格要用\转义
    options "ro root=UUID=根分区的UUID rw  quiet apparmor=1 security=apparmor resume=UUID=SWAP的UUID udev.log_priority=3 audit=0 acpi_osi=Windows\ 2015 reboot=kbd ivrs_ioapic[32]=00:14.0 amd_iommu=on idle=nomwait bootsplash.bootfile=bootsplash-themes/manjaro/bootsplash initrd=/boot/amd-ucode.img"
}
menuentry "Windows 10" {
    loader \EFI\Microsoft\Boot\bootmgfw.efi
}
include refind-theme-dark/theme.conf

更换主题

git clone https://github.com/samuelmeuli/refind-theme-dark.git
sudo su
cp refind-theme-dark /boot/efi/EFI/refind

然后编辑refind-theme-dark/theme.conf文件,删去其中的所有themes/

再编辑/boot/efi/EFI/refind/refind.conf文件,将最后一行改为:

include refind-theme-dark/theme.conf

再将背景图片用gimp修改为全黑,以保证windowslinux启动时的效果

BIOS设置

重启电脑,按F2进入BIOS设置,在Secure中关闭安全启动、重置Key、进入自定义设置模式,然后按F10保存退出

自定义安全启动

各种安全文件的建立

参考如何在 Linux 系统启用 UEFI 的 Secure Boot

mkdir mok2
cd mok2
echo $(uuidgen) >guid
cat guid 
echo  77fa9abd-0359-4d32-bd60-28f4e78f784b >ms-guid
openssl req -new -x509 -newkey rsa:2048 -subj "/CN=Platform Key/" -keyout PK.key -out PK.crt -days 3650 -nodes -sha256
openssl req -new -x509 -newkey rsa:2048 -subj "/CN=Key Exchange Key/" -keyout KEK.key -out KEK.crt -days 3650 -nodes -sha256
openssl req -new -x509 -newkey rsa:2048 -subj "/CN=Database/" -keyout db.key -out db.crt -days 3650 -nodes -sha256
cert-to-efi-sig-list -g $(cat guid) PK.crt PK.esl
cert-to-efi-sig-list -g $(cat guid) KEK.crt KEK.esl
cert-to-efi-sig-list -g $(cat guid) db.crt db.esl
curl -L http://go.microsoft.com/fwlink/?LinkID=321185 -o MSKEK.der
curl -L http://go.microsoft.com/fwlink/?LinkID=321192 -o MSdbWPCA.der
curl -L http://go.microsoft.com/fwlink/?LinkID=321194 -o MSdbUDSCA.der
openssl x509 -in MSKEK.der -inform DER -out MSKEK.crt
openssl x509 -in MSdbWPCA.der -inform DER -out MSdbWPCA.crt
openssl x509 -in MSdbUDSCA.der -inform DER -out MSdbUDSCA.crt
cert-to-efi-sig-list -g $(cat ms-guid) MSKEK.crt MSKEK.esl
cert-to-efi-sig-list -g $(cat ms-guid) MSdbWPCA.crt MSdbWPCA.esl
cert-to-efi-sig-list -g $(cat ms-guid) MSdbUDSCA.crt MSdbUDSCA.esl
cat KEK.esl MSKEK.esl >realKEK.esl
cat db.esl MSdbWPCA.esl MSdbUDSCA.esl >realDB.esl
sign-efi-sig-list -k PK.key -c PK.crt PK PK.esl PK.esl.signed
sign-efi-sig-list -k PK.key -c PK.crt KEK realKEK.esl realKEK.esl.signed
sign-efi-sig-list -k KEK.key -c KEK.crt db realDB.esl realDB.esl.signed
#manjaro默认挂载了efivarfs分区的
efi-updatevar -f PK.esl.signed PK
efi-updatevar -f realKEK.esl.signed KEK
efi-updatevar -f realDB.esl.signed db

签名过程

与前面参考过程的文章不同,使用refind实现secure boot时需要对多个文件签名,而不是使用grub时那样仅对一个文件签名

cp /boot/efi/EFI/refind/refind_x64.efi refind_x64.efi.origin
sbsign --key db.key --cert db.crt --output refind_x64.efi.signed refind_x64.efi.origin
cp refind_x64.efi.signed /boot/efi/EFI/refind/refind_x64.efi
cp refind_x64.efi.signed /boot/efi/EFI/Boot/bootx64.efi
cp /boot/efi/EFI/refind/drivers_x64/ext4_x64.efi ext4_x64.efi.origin
sbsign --key db.key --cert db.crt --output ext4_x64.efi.signed ext4_x64.efi.origin
cp ext4_x64.efi.signed /boot/efi/EFI/refind/drivers_x64/ext4_x64.efi
cp /boot/vmlinuz-4.19-x86_64 vmlinuz-4.19-x86_64.origin
sbsign --key db.key --cert db.crt --output vmlinuz-4.19-x86_64.signed vmlinuz-4.19-x86_64.origin
cp vmlinuz-4.19-x86_64.signed /boot/vmlinuz-4.19-x86_64

后续

重启,进入BIOS,打开Secure Boot,然后就一切正常了。
这个方法也存在一个缺点,即每次更新内核后,都必须对内核再次签名,不如使用grub时方便,不过refindgrub好看一点,而且我的机器上grub出现问题时它能正常使用,暂且如此罢。