跳到主要内容

SDK 打包文件

1. 将自定义文件打包至系统镜像

Luckfox Pico SDK 在打包前会通过 overlay 机制将指定文件添加到根文件系统中。

  1. 创建overlay目录:在project/cfg/BoardConfig_IPC/overlay下新增自定义文件夹(例如custom-overlay)。

  2. 按根文件系统结构添加文件:

    # 示例:overlay-luckfox-buildroot-shadow
    project/cfg/BoardConfig_IPC/overlay/custom-overlay/
    └── etc
    ├── samba
    │ ├── smb.conf
    │ └── smbpasswd
    ├── shadow
    └── ssh
    └── sshd_config
  3. 配置板级支持文件。在project/cfg/BoardConfig_IPC/BoardConfig.mk中添加:

    export RK_POST_OVERLAY="custom-overlay" # 替换为实际文件夹名称
  4. 编译打包:

    ./build.sh firmware # 生成包含 overlay 的 rootfs.img

2. 文件共享

虚拟机和 Windows 电脑之间文件传输可以使用 Samba 服务来实现文件共享,在 Windows 的网络邻居中,可以轻松访问虚拟机的文件系统,非常便捷。

2.1 Ubuntu 环境配置

  1. 下载和安装 Samba 。

    sudo apt-get update
    sudo apt-get install samba -y
  2. 配置Samba服务。

    sudo vim /etc/samba/smb.conf

    #在文件末尾填入以下内容

    [share]
    comment = share folder
    browseable = yes
    path = /home/luckfox
    create mask = 0700
    directory mask = 0700
    valid users = luckfox
    force user = luckfox
    force group = luckfox
    public = yes
    available = yes
    writable = yes
    • 其中luckfox为主机名,根据自己实际主机名填写。
  3. 设置分享账户密码。

    sudo smbpasswd -a luckfox
  4. 查看虚拟机或主机的 IP 地址。

    luckfox@luckfox:~/Luckfox-Pico/luckfox-pico$ ifconfig
    enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
    inet 192.168.10.61 netmask 255.255.252.0 broadcast 192.168.11.255
    inet6 fe80::814f:a51e:5f24:f0f7 prefixlen 64 scopeid 0x20<link>
    ether 08:00:27:d2:60:b9 txqueuelen 1000 (Ethernet)
    RX packets 699559 bytes 754875799 (754.8 MB)
    RX errors 0 dropped 4 overruns 0 frame 0
    TX packets 53024 bytes 3278048 (3.2 MB)
    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

    lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
    inet 127.0.0.1 netmask 255.0.0.0
    inet6 ::1 prefixlen 128 scopeid 0x10<host>
    loop txqueuelen 1000 (Local Loopback)
    RX packets 190 bytes 24144 (24.1 KB)
    RX errors 0 dropped 0 overruns 0 frame 0
    TX packets 190 bytes 24144 (24.1 KB)
    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

2.2 Windows 环境

  1. 在 Windows 地址栏输入(根据自己实际 IP 地址填写)。

  2. 输入虚拟机账户密码默认都是 luckfox 。

  3. 成功登录虚拟机或主机。