Category: Linux

  • 在Radxa Zero 3上运行deepseek

    在Zero上编译非常痛苦,所以使用交叉编译:

    安装步骤
    更新包列表:

    sudo apt update
    安装交叉编译工具链:

    sudo apt install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
    //gcc-aarch64-linux-gnu:ARM64架构的C编译器。

    //g++-aarch64-linux-gnu:ARM64架构的C++编译器。

    验证安装:

    aarch64-linux-gnu-gcc –version
    aarch64-linux-gnu-g++ –version

    1. 设置交叉编译环境
      在项目目录中创建一个 toolchain.cmake 文件,用于指定交叉编译工具链。

    创建 toolchain.cmake 文件
    cmake

    toolchain.cmake

    set(CMAKE_SYSTEM_NAME Linux)
    set(CMAKE_SYSTEM_PROCESSOR aarch64)

    set(CMAKE_C_COMPILER /usr/bin/aarch64-linux-gnu-gcc)
    set(CMAKE_CXX_COMPILER /usr/bin/aarch64-linux-gnu-g++)

    set(CMAKE_FIND_ROOT_PATH /usr/aarch64-linux-gnu)
    set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
    set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
    set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

    1. 交叉编译项目
      使用交叉编译工具链编译项目。

    步骤 1:生成构建文件

    cmake -B build -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake
    步骤 2:编译项目

    cmake –build build –config Release -j 2
    步骤 3:验证编译结果
    检查生成的可执行文件是否为ARM64架构:

    file build/my_program
    输出示例:

    build/my_program: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 3.7.0, not stripped

    1. 将程序复制到RK3566
      使用 scp 或U盘将编译好的程序复制到RK3566上运行。

    使用 scp 复制

    scp build/my_program user@rk3566_ip:/path/to/destination
    在RK3566上运行

    ./llama-server -m DeepSeek-R1-Distill-Qwen-1.5B-Q4_K_M.gguf –host 0.0.0.0

    使用精简蒸馏模型DeepSeek-R1-Distill-Qwen-1.5B-Q4_K_M.gguf

    结果还是非常意料之内的,缓慢无比。0.2 t/s

  • Radxa 3w zero connect wifi before login

    So here is the thing:
    I want to use one of my radxa 3w zero to be a light server, but for some reason their CLI version can not start up, which is insane. And I tried, it just stuck at the beginning.

    So I uninstalled the xfce of debian-xfce version. And everything I need were working properly.
    Except the Wi-Fi. It only connects when I login.

    I have tried several methods. And finally.

    At /etc/NetworkManager/system-connections/mywifi.nmconnection

    Then disable the line “permissions” and it works.

  • Protected: Delete a NVROM entry[reference]

    This content is password protected. To view it please enter your password below:

  • Fixed my corrupted database last night

    For some reason, I turned off the power switch last night, before I have done it, I forgot to shut down my home servers correctly. Then, it was not a surprise that the database on one of my Raspi crashed.
    In order to solve this problem, Follow the message it provide, use “journalctl -xe” command to show related information. Modify “my.cnf”, add ” innodb_force_recovery > 0 ” then start the database, afterward comment the ” innodb_force_recovery > 0″ line in again, restart the database subsequently. Done.

  • Use a SMB directory on Apache2

    Install samba client:

    apt-get install  samba-common smbclient samba-common-bin smbclient  cifs-utils
    
    mkdir /mnt/abc
    mount -t cifs //yourIP/yourShare /mnt/abc
    
    

    If you need to add credentials at the mount time:

    
    mount -t cifs //server/share /mnt/abc -o user=user,pass=password,dom=domain
    

    If you want to dismount the share later:

    umount /mnt/abc
    

    Mount permanently:

    sudo nano /etc/fstab
    

    Add: //server/share /mnt/abc cifs guest,uid=1000,iocharset=utf8,x-systemd.automount 0 0

    For more information visit:
    https://wiki.ubuntu.com/MountWindowsSharesPermanentlyUbuntu forum

    Access Permission(May not necessary):

    chown -R $USER:$USER /mnt/abc
    chmod -R 755 /mnt/abc
    

    Apache2 on Debian based OS:

    Modify apache2.conf add lines:

    <Directory /mnt/abc/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted

    Modify conf in sites-available directory:

        <VirtualHost *:80>
    DocumentRoot /mnt/abc
    ServerName myv.host.com
    ServerAlias myv.host.com
    ErrorLog logs/myvhost-error_log
    CustomLog logs/myvhost-access_log combined
    ServerAdmin [email protected]
    <Directory /mnt/abc/>
        AllowOverride All
        Options +Indexes
    </Directory>
    </VirtualHost>