Raspberry Pi(中文名为“树莓派”,简写为RPi,(或者RasPi / RPI) 。
其有如下型号。
树莓派仅使用 TF卡作为存储设备,因此树莓派的操作系统也是烧写到TF卡上的。
若在TF卡内没装操作系统,那么上电之后树莓派不会有任何反应; 树莓派没有类似电脑主板的BIOS。
树莓派的操作系统映像可以从官方网站上下载:
https://www.raspberrypi.org/downloads/
本文使用的是Raspbian官方操作系统。
关于第三方提供的操作系统映像,在官方网站上也可以找到。
可以使用 win32diskimager 工具把操作系统映像烧写到TF卡上。 如下图,打开Win32 Disk Imager并选择下载好的Raspbian操作系统映像。
点击yes继续,这里需要注意,操作系统映像的路径中不能包含中文,否则会提示以下的错误。
烧写成功之后,TF卡会刷新为一个名字为boot的移动存储介质,这时我们需要修改这个盘下的 config.txt 文件。由于TF卡被格式化为了Windows下无法识别的文件类型,因此在Windows下只能看到40MBytes左右的大小。
由于树莓派没有BIOS,因此Raspbian在启动过程中会读取引导区(Linux的默认引导区为/boot/)中的 config.txt 这个配置文件中的内容对硬件进行配置。
# uncomment if you get no picture on HDMI for a default "safe" mode
# hdmi_safe=1
# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
# disable_overscan=1
# uncomment the following to adjust overscan. Use positive numbers if console goes off screen, and negative if there is too much border
# overscan_left=16
# overscan_right=16
# overscan_top=16
# overscan_bottom=16
# uncomment to force a console size. By default it will be display's size minus overscan.
# framebuffer_width=1280 # 显存Framebuffer的配置,配置显示宽度
# framebuffer_height=720 # 显存Framebuffer的配置,配置显示高度
# uncomment if hdmi display is not detected and composite is being output
hdmi_force_hotplug=1 # 即便没有检测到 HDMI 显示器也要使用 HDMI 模式
# uncomment to force a specific HDMI mode (this will force VGA)
hdmi_group=2 #设置HDMI类型不指定组,或者设为0,将会使用EDID报告的首选组:hdmi_group=1 CEA,2为DMT
hdmi_mode=16
# uncomment to force a HDMI mode rather than DVI. This can make audio work in DMT (computer monitor) modes
hdmi_drive=2
# uncomment to increase signal to HDMI, if you have interference, blanking, or no display
config_hdmi_boost=4
# uncomment for composite PAL
sdtv_mode=2
# uncomment to overclock the arm. 700 MHz is the default.
arm_freq=800
# for more options see http://elinux.org/RPi_config.txt
配置完config.txt文件之后,为了使树莓派3支持SSH2连接,我们还需要在boot底下新建一个SSH.txt文件。
完成上述操作之后,我们就可以把TF卡插到树莓派主板上,让树莓派上电运行了。
树莓派正常运行时的状态灯情况是: 红灯常亮,绿灯闪烁。 这样表示树莓派正在正常运行。
树莓派正常运行后,我们用网线连接树莓派的以太网口和路由器,然后登录路由器查看树莓派的IP地址。
接下来就可使用终端程序(SecureCRT、Xshell、当然Linux shell或者Windows cmd下使用SSH命令也是可以的!)连接树莓派了,配置如下。
账号: pi
密码: raspberry