Raspberry pi(-) Mac下安装系统

购买树莓派一般的操作说明书都是windows下的,因为本人只有MBP,外加虚拟机Parallels Desktop无法识别SD卡,所以就直接参考Mac教程了。

1.系统镜像官网下载 推荐用Raspbian。

2.插入sd卡,df-h 查看当前挂载卷

frost:~ frost$ df -h

Filesystem           Size   Used  Avail Capacity  iused    ifree %iused  Mounted on

/dev/disk0s2        465Gi  160Gi  304Gi    35% 42083846 79802896   35%   /

devfs               197Ki  197Ki    0Bi   100%      682        0  100%   /dev

map -hosts            0Bi    0Bi    0Bi   100%        0        0  100%   /net

map auto_home         0Bi    0Bi    0Bi   100%        0        0  100%   /home

vfstool#vm-pid1607   64Gi   53Gi   11Gi    83%        0        0  100%   /Volumes/C

vfstool#vm-pid1607  350Mi   43Mi  307Mi    13%        0        0  100%   /Volumes/F

/dev/disk1s1         15Gi   32Ki   15Gi     1%        0        0  100%   /Volumes/NO NAME

查看Size和Name可以知道对应的设备文件(此处是/dev/disk1s1),如果有多个分区,可能会有disk1s2之类,可以用diskutil unmount 将分区卸载掉。

frost:Desktop frost$ diskutil unmount /dev/disk1s1

Volume NO NAME on disk1s1 unmounted

3.diskutil list 确认设备

frost:~ frost$ diskutil list

/dev/disk0

   #:                       TYPE NAME                    SIZE       IDENTIFIER

   0:      GUID_partition_scheme                        *500.1 GB   disk0

   1:                        EFI EFI                     209.7 MB   disk0s1

   2:                  Apple_HFS Macintosh HD            499.2 GB   disk0s2

   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3

/dev/disk1

   #:                       TYPE NAME                    SIZE       IDENTIFIER

   0:     FDisk_partition_scheme                        *16.0 GB    disk1

   1:             Windows_FAT_32 NO NAME                 16.0 GB    disk1s1

frost:~ frost$

4.用dd命令将系统镜像写入,注意disk后的数字,不能搞错

  (ps:/dev/disk1s1是分区,/dev/disk1是块设备,/dev/rdisk1是原始字符设备)

frost:Desktop frost$ sudo dd bs=4m if=2014-01-07-wheezy-raspbian.img of=/dev/rdisk1

706+1 records in

706+1 records out

2962227200 bytes transferred in 271.346874 secs (10916754 bytes/sec)

如果出现Operation not supported或者Resource busy的错误,说明你没有把该设备上的所有卷都卸载掉,用df检查一下。

如果出现Permission denied的错误,说明SD卡被写保护了,检查SD卡的写保护开关是不是打开了(我打开反了,汗),另外Mac的SD卡槽对写保护开关的检测有问题,可以参看这篇文章进行解决。

5.用diskutil unmountDisk 卸载设备

frost:Desktop frost$ diskutil unmountDisk /dev/disk1

Unmount of all volumes on disk1 was successful

6.组装好树莓派,因为没有显示屏,必须用有线连接入网络,登陆路由器查看树莓派网络ip

  然后ssh 连接登陆,账号默认是pi,密码是raspberry

ssh pi@192.168.1.103

pi@raspberrypi~ $

 

 7.输入

sudo raspi-config

1 

进行接下去的设置

  • 1.Expand Filesystem -扩充SD卡,系统镜像只有1.8G,不扩充无法发挥多余空间。
  • 2.Change User password -修改密码
  • 3.Enable Boot to Desktop/Scratch-登录是桌面还是别的Scratch或者命令行
  • 4.Internationalisation Options-设定系统语言时区,
    建议系统locale设置为en_US.UTF-8或者en_GB.UTF-8,因为系统默认没有安装中文字体,如果设定为中文显示,系统中很多字都会变成方块,其实默认是英文也没有什么障碍吧,
    如果设置出现了“perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = (unset), LC_ALL = (unset), LC_CTYPE = "UTF-8", LANG = "en_GB.UTF-8" are supported and installed on your system. perl: warning: Falling back to the standard locale ("C").” 的错误,直接vi .bashrc 里面加一句export LC_ALL=C就好了,保存后记得source .bashrc默认vi很蛋疼,建议装个vim吧,别太委屈自己!
    如果对于中文还是有些强迫的,可以安装字体 sudo apt-get install ttf-wqy-zenhei 安装文泉驿的开源中文字体(唯一开源中文字体库)
    Timezone选择 Asia/shanghai吧!keyboard 都是选Generic 101-key pc    ->  other  -> English(US)
    中文输入在linux下很久就有了,可以用sudo apt-get install scim-pinyin 安装 scim拼音,Ctrl+Space可以切换 
  • 5.Enable Camera-设置摄像头,感觉好像开始的时候没有摄像头模块,迟点我自己来设置或者加个摄像头吧
  • 6.Add to Rastrack-添加到online树莓派地图
  • 7.Overlock-锁定什么选项吧
  • 8.Advanced Options-高级配置
  • 9.About raspi-config -树莓派的说明吧

 8.最后教一下怎么外接显示屏,直接调整SD卡里面的config.txt,配置为如下就可以直接HDMI 转VGA口连接外部显示屏了,不然可能会是黑的屏幕,表示出了bug下定决心要买个HDMI转VGA口了。

hdmi_safe=1
overscan_left=-30
overscan_right=-30
overscan_top=-30
overscan_bottom=-30
hdmi_group=2
hdmi_mode=4
hdmi_drive=2
config_hdmi_boost=4

ok,到这一步就算配置完成了,接下去可以做点别的事情了,没有显示屏的这样就可以继续玩了,接下去的都是自己远程ssh继续玩了!

原文地址:https://www.cnblogs.com/xiaokangfrost/p/3520108.html