准备一张16G的sd卡和读卡器,从官方下载最新的固件。
操作电脑为Ubuntu 16.04。
将sd卡接入pc,ubuntu可能会自动挂载sd卡,使用df命令查看挂载了哪些分区。使用umount命令卸载sd卡分区。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | herbert@herbert-pc:/work/raspberry_pi$ df Filesystem 1K-blocks Used Available Use% Mounted onudev 4006348 0 4006348 0% /devtmpfs 805324 9684 795640 2% /run/dev/sda2 14287344 10474676 3063868 78% /tmpfs 4026616 8736 4017880 1% /dev/shmtmpfs 5120 4 5116 1% /run/locktmpfs 4026616 0 4026616 0% /sys/fs/cgroup/dev/sda1 291252 3480 287772 2% /boot/efi/dev/sda3 100541880 16399016 79012524 18% /worktmpfs 805324 72 805252 1% /run/user/1000/dev/sde1 15205864 8 15205856 1% /media/herbert/raspberryroot@herbert-pc:/work/raspberry_pi# umount /dev/sde1 |
如果不确定那个分区是sd卡的分区,可以插入sd卡后,执行:
1 2 3 4 5 6 7 8 9 10 11 | herbert@herbert-pc:/work$ dmesg | tail[ 18.781662] usbcore: registered new interface driver uas[ 19.778922] scsi 6:0:0:0: Direct-Access Generic STORAGE DEVICE 0272 PQ: 0 ANSI: 0[ 19.779143] sd 6:0:0:0: Attached scsi generic sg4 type 0[ 19.892220] sd 6:0:0:0: [sde] 30449664 512-byte logical blocks: (15.6 GB/14.5 GiB)[ 19.893063] sd 6:0:0:0: [sde] Write Protect is off[ 19.893067] sd 6:0:0:0: [sde] Mode Sense: 0b 00 00 08[ 19.894133] sd 6:0:0:0: [sde] No Caching mode page found[ 19.894137] sd 6:0:0:0: [sde] Assuming drive cache: write through[ 19.898460] sde: sde1[ 19.900983] sd 6:0:0:0: [sde] Attached SCSI removable disk |
解压下载的zip文件:
1 2 3 | root@herbert-pc:/work/raspberry_pi# unzip 2017-09-07-raspbian-stretch.zip Archive: 2017-09-07-raspbian-stretch.zip inflating: 2017-09-07-raspbian-stretch.img |
烧些:
1 2 3 4 5 6 | root@herbert-pc:/work/raspberry_pi# dd bs=4M if=2017-09-07-raspbian-stretch.img \of=/dev/sde status=progress conv=fsync4915724288 bytes (4.9 GB, 4.6 GiB) copied, 503.045 s, 9.8 MB/s 1172+1 records in1172+1 records out4916019200 bytes (4.9 GB, 4.6 GiB) copied, 638.549 s, 7.7 MB/s |
烧些完毕后,执行:
1 | root@herbert-pc:/work/raspberry_pi# sync |
将页高速缓存的数据写入到设备。
拔掉sd卡,将其装到树莓派板子上,接上显示器,启动,可以进入系统。接上鼠标键盘音响,就是一台普通的PC。
官方安装指南:
https://www.raspberrypi.org/documentation/installation/installing-images/linux.md