简介
在本篇文章中我们主要对PocketBeagle2的开发环境进行搭建,来实现烧录镜像和能够使用SSH登录进系统。实际上官方已经有部分的教程了,但是就算跟着教程搭建的话还难免会有失败。
1- 首先可以访问官方的https://docs.beagle.cc/boards/pocketbeagle-2/02-quick-start.html 页面进行查看烧录指南
2- 其中主要需要的软件是bb-imager-rs 或者是 BalenaEtcher来对镜像进行烧录。
这里需要注意的是,如果直接搜索bb-imager-rs进行下载的话,这个软件可能会出现无法发现外部挂载的U盘设备。 如果使用的是bb-imager-rs的话即通过下文的release page下载的话,其软件内自带的镜像支持并没有直接搜索的bb-imager-rs镜像多。且我这边使用的是release page中的bb-imager-rs ,在烧录的时候出现分区错误且已经更换了多个文件系统和格式化多次(使用bb-imager-rs格式化的话一直处于准备状态)。因此我这里使用的是BalenaEtcher,最起码可以烧录成功。
Release page
3- 镜像的选择不建议使用最新的镜像或者IOT镜像,在我第一次烧录的的时候使用的是最新的,但是无法连接SSH,不知道是什么原因。可以直接使用官方教程中的https://www.beagleboard.org/distros/pocketbeagle2-debian-12-9-2025-01-15-minimal镜像进行烧录
4- 修改boot分区下的配置文件
# This file will be automatically evaluated and installed at next boot # time, and regenerated (to avoid leaking passwords and such information). # # To force it to be evaluated immediately, you can run (as root): # # /usr/sbin/bbbio-set-sysconf # # You can disable the file evaluation by disabling the bbbio-set-sysconf # service in systemd: # # systemctl disable bbbio-set-sysconf # # Comments (all portions of a line following a '#' character) are # ignored. This file is read line by line. Valid # configuration lines are of the form 'key=value'. Whitespace around # 'key' and 'value' is ignored. This file will be _regenerated_ every # time it is evaluated. # # We follow the convention to indent with one space comments, and # leave no space to indicate the line is an example that could be # uncommented. # root_password - Set a password for the root user (not used in ubuntu) root_password=FooBar # root_authorized_key - Set an authorized key for a root ssh login (not used in ubuntu) #root_authorized_key= # user_name - Set a user name for the user (1000) user_name=beagle # user_password - Set a password for user (1000) user_password=FooBar # user_authorized_key - Set an authorized key for a user (1000) ssh login #user_authorized_key= # iwd_psk_file - Set a configuration for iwd https://wiki.archlinux.org/title/iwd #iwd_psk_file= # wifi_regdom - Country Code (ISO Alpha-2) Requests the country be set for the system. #wifi_regdom=US # hostapd_file - Set a configuration for hostapd https://wiki.gentoo.org/wiki/Hostapd #hostapd_file=SoftAp0.conf # hostname - Set the system hostname. hostname=BeagleBone # keymap - Set the system keymap. keymap=us # timezone - Set the system timezone. timezone=America/Chicago # enable_ufw - enable ufw firewall (https://en.wikipedia.org/wiki/Uncomplicated_Firewall) #enable_ufw=yes # ufw_allow_ssh - allow ssh access over port 22 #ufw_allow_ssh=yes # ufw_allow_http - allow http access over port 80 #ufw_allow_http=yes # ufw_allow_https - allow https access over port 443 #ufw_allow_https=yes # ufw_allow_nodered - allow nodered access over port 1880 (https://nodered.org/) #ufw_allow_nodered=yes # ufw_allow_vscode - allow vscode access over port 3000 (https://github.com/coder/code-server) #ufw_allow_vscode=yes # ufw_allow_vnc - allow vnc access over port 5901 #ufw_allow_vnc=yes # ufw_allow_cockpit - allow cockpit access over port 9090 (https://cockpit-project.org/) #ufw_allow_cockpit=yes
在上述可以打开root账号和密码的注释,以及将普通用户的用户名和密码打开。
5- 然后将开发板上电,目测观察开发板的启动状态
注意: 启动可能需要一点时间,如果正常启动的话。上述的绿灯应该是会闪烁或者是常亮。
6- 接下来是需要使用SSH来连接上开发板。
首先打开MAC的网络管理,在网络管理中找到Beagle的开发板网络。然后停用再启用这个设置,MAC便会自动的连接。
7- 然后使用Ping 命令测试到192.168.6.2的连接性。
8- 直接使用SSH连接,ssh username@ipaddr
这便是已经成功的连接上去了,并且可以看到内存的使用信息。可以看到当前的连接是从192.168.6.1 发起的连接, 而这个开发板的地址是在.6.2, 两者都是在同一个子网下,因此可以进行通讯。
后续
可以看到这个MAC上的配置还是比较麻烦的(上述的文章其实并不是一遍就写好的。踩坑了很多最终完成的这次配置)。其实我还尝试了共享MAC的网络给开发板,但是发现共享网络后分配给比格犬的开发板的地址位于16x.网段,因此只是一个临时地址。在尝试连接的时候也出现了连接不上的情况。这两天看下怎么能解决这个问题。下一步的话将使用VSCode连接上去进行应用程序的开发。比如说先点亮个LED。