现在的位置: 首页 > 综合 > 正文

安装树莓派 Raspberry PI

2019年01月12日 ⁄ 综合 ⁄ 共 3697字 ⁄ 字号 评论关闭

安装树莓派

树莓派终于到货了,是这个样子的

树莓派

上面有一行日期是 Raspberry PI (c) 2011.12

下载镜像,写入SD卡

http://www.raspberrypi.org/downloads/

选择这个镜像: RASPBIAN Debian 2014-01-07

780M的压缩包,很大的样子

似乎还有个NOOBS的安装方式,完全无感

顺便展示一下SD卡,通过查阅可用SD卡列表,似乎是支持个别的64G Class10的卡的,就像这个,编号是 Transcend SDXC 64G Class10 TS64GSDXC10

SD

用 Win32DiskImager 写入SD卡

Win32DiskImager

Win32DiskImager 是一个Qt程序,在我的机器上启动很慢,应该不是所有机器都这样。可能是检查我的磁盘吧。

连接DVI显示器

这个显示器没有HDMI的接口。但是有VGA和DVI的口,VGA给原有的PC机用,所以准备了DVI口给树莓派使用

显示器后面是酱子

显示器

再展示一下DVI转HDMI的线

DVI-HDMI

连好小PI后,显示器居然是漆黑的,不是说这货启动非常简单吗。由于无法串口调试,只好怀疑是不是不支持大卡,就把数码相机里的8G卡拿出来,又做了一个系统,显示器仍然啥都没有。

这个问题直到连接网卡,并且HDMI直连电视机后才解决

有个嵌入式Linux的wiki帮了大忙:

http://elinux.org/RPiconfig

hdmi_safe Use "safe mode" settings to try to boot with maximum hdmi compatibility. This is the same as the combination of: hdmi_force_hotplug=1, hdmi_ignore_edid=0xa5000080, config_hdmi_boost=4, hdmi_group=2, hdmi_mode=4, disable_overscan=0, overscan_left=24,
overscan_right=24, overscan_top=24, overscan_bottom=24

HDMI 转DVI还是OK的,这样设置: 编辑 /boot/config.txt
实际可以吧SD卡插到PC上编辑

# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1

hdmi_safe=1 放开即可。这样分辨率好像不对,不过先能显示出来总是好的

hdmi_safe=1

这个真不容易,上图

dvi-display

连接网卡

连上有线网,在路由器的列表中找到了raspberrypi,连接ssh也ok。终于确认这个系统启动是成功的。

默认用户名 pi@raspberry

Linux raspberrypi 3.10.25+ #622 PREEMPT Fri Jan 3 18:41:00 GMT 2014 armv6l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Apr 28 15:54:18 2014 from 192.168.2.4

NOTICE: the software on this Raspberry Pi has not been fully configured. Please run 'sudo raspi-config'


pi@raspberrypi:~$ free
             total       used       free     shared    buffers     cached
Mem:        448180      51460     396720          0       8096      22288
-/+ buffers/cache:      21076     427104
Swap:       102396          0     102396
pi@raspberrypi:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
rootfs          2.6G  2.0G  469M  82% /
/dev/root       2.6G  2.0G  469M  82% /
devtmpfs        211M     0  211M   0% /dev
tmpfs            44M  204K   44M   1% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs            88M     0   88M   0% /run/shm
/dev/mmcblk0p1   56M   19M   38M  34% /boot
pi@raspberrypi:~$ 

从这个信息上看

  1. sudo raspi-config 可以系统设置
  2. 内存大小是448M,使用51M,这个是只启动控制台的。如果有GUI会在100M以上
  3. 可用的分区一个2G。这个要在配置时扩展。
  4. 100M的swap

顺便看了下编译环境 gcc g++ python2.7 全有,还真是一台小电脑哈。

ssh

HDMI直连电视

这个非常顺利,应该先试试这个,再试DVI的
无线鼠标键盘都OK

这个第一次启动的样子
boot

扩展SD卡
extern

再看看磁盘状况,可用55G,不再是以前的400M的样子,很给力啊。
df

好了,这样视频输出功能是可用的,以后大部分会用VNC来显示,基本不再直连显示器和电视机了。

软件设置

启用root

首先是启用root,sudo神马的最讨厌了

sudo passwd root

SFTP服务是默认启动的

WinSCP已经是直接可用了

winscp
这样samba服务暂时就不设了,有需要再说

换更快的软件源

打开/etc/apt/sources.list 有这样一条

deb http://mirrordirector.raspbian.org/raspbian/ wheezy main contrib non-free rpi

Raspberry Pi(树莓派)国内软件源有这些:

deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ wheezy main contrib non-free rpi 
deb-src http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ wheezy main contrib non-free rpi 

deb http://mirrors.neusoft.edu.cn/raspbian/raspbian/ wheezy main contrib non-free rpi 
deb-src http://mirrors.neusoft.edu.cn/raspbian/raspbian/ wheezy main contrib non-free rpi 

deb http://mirrors.ustc.edu.cn/raspbian/raspbian/ wheezy main contrib non-free rpi 
deb-src http://mirrors.ustc.edu.cn/raspbian/raspbian/ wheezy main contrib non-free rpi

由于树莓派没有Ubuntu那样的手动测试最快的源
于是自己测了下,还是中科大ustc的最快, 最后ping的time结果

站点 Time
mirrordirector.raspbian.org 476
mirrors.tuna.tsinghua.edu.cn 2749
mirrors.neusoft.edu.cn 156
mirrors.ustc.edu.cn 13

所以最后的/etc/apt/sources.list

deb http://mirrors.ustc.edu.cn/raspbian/raspbian/ wheezy main contrib non-free rpi 
deb-src http://mirrors.ustc.edu.cn/raspbian/raspbian/ wheezy main contrib non-free rpi

然后

apt-get update

安装 xrdp

apt-get install xrdp

启动windows的远程桌面 mstsc

mstsc

看效果

明显鼠标反应迟滞,算了,反正以后使用GUI的机会不多。

查看温度

cat /sys/class/thermal/thermal_zone0/temp 
44925

也许是44度吧

路由器分配静态IP

强制指定路由器的IP分配策略,让路由器绑定树莓派的物理地址和IP

功率

最后看一下功率的问题,在不接HDMI输出的情况下,cpu空载。功率只有2.7到3W,真的是很厉害,是笔记本的1/10啊

power

嘛,就先写到这里吧。

============================

最后把Markdown的代码块转成CSDN blog 的方法

把 <pre><code> 替换成<pre name="code" class="plain">    
把</code></pre> 替换成 </pre>

<blockquote> 暂时没有替换的
还有老老实实用宋体,不要再换字体了,否则代码里面会出现font-family这样的东西

抱歉!评论已关闭.