对 Raspberry PI 2 Model B 安装使用过程中用到的资源和碰到的问题进行记录。

资源链接

系统盘 (sd) 制作

  • 这里 有官方和第三方制作的可用操作 系统镜像。官方还提供了一种叫 NOOPS 的安装方式,我没有进行尝试。最后还是选了 传统的使用镜像安装工具的方式在 SD 上安装了 Raspian 系统。

  • 这里 列出了 Linux, Mac OS, Windows 下的镜像安装工具和使用步骤。除了 Windows 上的 Win32DiskImager 我还使用了 fedora-arm-installer

    • 注意,在 Windows 一定要使用管理员权限;

电源

有人说电脑的 USB 提供的电压电流 (5V/500A) 足够树莓派使用了,但是我始终没办法让 它使用电脑 USB 正常工作,最后换了 iPhone 6 的充电器。

靠谱的做法就是直接使用 5V/2A 的 USB 充电器,少走弯路。

另外,树莓派没有电源开关,只能通过插拨电源线开关。但是因为它毕竟是台电脑,所以 为了保证 SD 卡的数据不被损坏 (我经历过,只好重新写入操作系统镜像),尽量使用关 机命令关闭操作系统后或者树莓派的绿灯长时间不停时 (表明没有 SD 读写) 时再拨掉电 源线。

无源 HDMI 转 VGA 线

我需要使用只有 VGA 接口的电脑显示器,所以,我就买了一条转接线。但是显示器始终 接收不到画面信号。

然后,有人说因为无源转接线功耗太大造成无法正常显示,甚至会烧坏树莓派的某些部件。 有人说,烧坏的例子基本没有,能够正常使用,只要修改一下 SD 卡的配置文件 config.txt。 我的某宝卖家提供了一个修改后的文件,覆盖 SD 上的文件后,终于看到期待的启动滚动字符了。

配置

第一次正常启动后,树莓派会执行 rasp-config 配置工具,就是那个蓝底的 curses 程序,里面的配置项基本看说明就能用了。配置完,reboot 后就能使用 pi/raspberry 进入系统了。

键盘

进入系统后,发现某些字符在 vi 和终端都无法正常输入,比如 |& 等字符。这 时候需要修改一下 keyboard layout,从英国键改为美国键。

树莓派论坛有说明。 由于我使用的是基于 DebianRaspian,我可以使用下面的命令进行修改。

    sudo dpkg-reconfigure locals     # 设置 locale 为 en_US.UTF-8
    sudo dpkg-reconfigure keyboard-configuration

熟悉的字符又回来了。

解锁 root

不能用 root,就无法感受到那种 ”至高无上“,用 sudo 会有种寄人篱下的伤感。用 下面命令解锁 root

    sudo passwd root
    sudo passwd --unlock root

好了,这时候树莓才真正是你的了。

这个问题是我折腾时间最久的。

手里原先买的 USB 小网卡,觉得应该插上就能用了,结果无法识别。看到的解决方案有: 下载已经编译好的驱动模块, 下载源代码重新编译该驱动,或者使 用 standalone 驱动源代码编译安装的。

后来,从 elinux.org 的 树莓派USB WiFi Adapters 列表 中看到:

TL-WN725N v2. Based on the Realtek RTL8188EUS chipset. Works out of the box on Rasbmc KODI 2014.12.25. Raspbian 3.18.xx+ includes a driver, but needs a separate firmware file downloading and installing. Earlier kernels need manual driver installation (simple version) and manual update after an upgrade.

正好最新的 Raspian 使用的就是 3.18+ 的内核,从这里 找到的对应的解决方案,主要解决步骤摘抄如下:

If you update to 3.18.xx+ there is a version of the driver included in the image so you don't need to download a new driver, however, it needs a separate fireware file downloading and installing.

    sudo wget https://github.com/lwfinger/rtl8188eu/raw/c83976d1dfb4793893158461430261562b3a5bf0/rtl8188eufw.bin -O /lib/firmware/rtlwifi/rtl8188eufw.bin

You will only need to do this once as it does not need updating when the linux version is updated. Also you will not need to load a new driver whenever you update the linux version as the new driver is now included in the code.

Once you have downloaded the firmware file reboot the Pi to bring up the wifi.

然后,要么修改 /etc/network/interfaces,要么使用 wpa_gui 配置工具,Wifi 就 可用了。

那么,问题又来了...

什么是树莓派的 firmware?

树莓派官方Githubfirmware repo可以看到:

This repository contains pre-compiled binaries of the current Raspberry Pi kernel and modules, userspace libraries, and bootloader/GPU firmware.

A rough guide to this repository and the licences covering its contents is below (check the appropriate directories for full licence details):

  • ./boot: *start.elf, bootcode.bin are the GPU firmware and bootloaders. Their licence is described in 'LICENCE.broadcom'. The kernel.img files are builds of the Linux kernel, released under the GPL (see COPYING.linux)
  • ./debug: pre-build modules for the kernel_debug.img
  • ./extra: System.map files for the provided kernel builds
  • ./hardfp: userspace VideoCoreIV libraries built for the armv6 hardfp ABI
  • ./modules: pre-built modules for kernel.img
  • ./opt/vc: includes userspace libraries for the VideoCoreIV (EGL/GLES/OpenVG etc). See ./opt/vc/LICENCE for licencing terms

也就是说,树莓派的 firmware 包含了一系列预先编译的内核和驱动、用户空间库和 GPU 驱动。然后,rpi-update 软件包基本算是官方推荐 的 firmware 更新工具。

但是为啥这些东西没有放到官方 apt 源里,使用包管理工具进行维护呢?

官方页面的评论 里找到了如下几个阐述:

... Shouldn't we Archers automatically have the latest firmware just doing a pacman -Syu? No. That updates all your Linux stuff, not the GPU blob or the boot fireware.

... Raspberry PI firmware is different to the OS? Yes. The firmware is the code that starts up the device, and is located on the GPU to make it work. It then hands control to the OS. A bit like the BIOS on a desktip.

... the firmware is stored on the SD card.

另外一个 Stackexchange 上对 firmware 和操作系统更完整的说明:

I think you might be conflating two different operations.

  • rpi-update is a tool to upgrade the firmware for your Raspberry Pi. Firmware is a small package of code that usually lives on a special chip of a computer that helps the software know how to talk to the hardware. However, in the case of the Raspberry Pi, the firmware will live on the first partition of the SD card.

  • Raspbian is an operating system or the core software for your Raspberry Pi. Software (including the OS) lives on second partition of the SD card and is all the stuff that gets executed when you use your device.

Both of these need updating independently. For convenience, the rpi-update tool is included in the Raspbian distribution of Linux because it is a useful software tool that manages the firmware of your Pi's. You should run it periodically to make sure your devices have the latest firmware. Separately, you need to keep your software up to date using the standard Debian software management tools like sudo apt-get update && sudo apt-get upgrade.

Each of these functions is separate, and updating one will not update the other. Upgrading your distribution to the latest software packages might get you a new version of rpi-update, but unless you RUN rpi-update your firmware will not get updated.

Since the place the firmware is stored is actually flashed to the first partition of the SD card (sort of like a BIOS), you will not need to run this on every device. Once you load a new version of software or firmware onto an SD card, any device you plug that card into will be running that version.

可但是,但可是,从官方文档中,又说目前使用 apt 包管理工具就可以更新内核及 firmware 了。那最 后的结论是类以 Debian 的 stable 和 unstable 发行分支一样,从源里来的是稳定和经 过严格测试的,而使用 rpi-update 可以获取到最新的 (bleeding edge) 内核及 firmware。

USB 摄像头

你可以掏和树莓派主机差不多的钱买一个不占用 USB 口的官方或者非官方的摄像头模块 或者从树莓派支持的 USB Webcams 列表 选一 个便宜点的 USB 摄像头。

接下来要做的事情,参考一下这里 吧,讲得很全面。还有下面几篇摄像头应用相关文章:

远程桌面

安装 VNS Server 或者 RDP Server

Comments

不要轻轻地离开我,请留下点什么...

comments powered by Disqus

Published

Category

RaspberryPI

Tags

Contact