官方資源

官網(https://www.raspberrypi.org/), 權威文件,HELP頁面下拉DOCUMENTATION。

GitHub(https://github.com/raspberrypi,較新,資料齊全。

RPi Hub(http://elinux.org/RPi_Hub,較舊,但可查到一些週邊已被網友測過支援性的型號。

安裝

Linux環境操作方式,參考以下連結:

http://qdosmsq.dunbar-it.co.uk/blog/2013/06/noobs-for-raspberry-pi/

  1. download NOOBS
  2. fdisk slplit sdcard(if need)
  3. mkfs.fat format sdcard
  4. unzip to sdcard

系統更新

sudo apt-get update

sudo apt-get upgrade

sudo apt-get dist-upgrade

vim順便裝起來

sudo apt-get install vim

操作實例

1) fdisk

未插入SD Card

handy@handy-dell ~ $ sudo fdisk -l

Disk /dev/sda: 240.1 GB, 240057409536 bytes
255 heads, 63 sectors/track, 29185 cylinders, total 468862128 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0f6535bd

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     1026047      512000    7  HPFS/NTFS/exFAT
/dev/sda2         1026048   264060927   131517440    7  HPFS/NTFS/exFAT
/dev/sda3       264060928   293357567    14648320   83  Linux
/dev/sda4       293359614   468860927    87750657    5  Extended
/dev/sda5       293359616   324607999    15624192   82  Linux swap / Solaris
/dev/sda6       324610048   468860927    72125440   83  Linux

Disk /dev/sdb: 750.2 GB, 750156374016 bytes
255 heads, 63 sectors/track, 91201 cylinders, total 1465149168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x9af12796

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1              63       80324       40131   de  Dell Utility
Partition 1 does not start on physical sector boundary.
/dev/sdb2   *       81920    25563135    12740608    7  HPFS/NTFS/exFAT
/dev/sdb3        25563136   654713009   314574937    7  HPFS/NTFS/exFAT
/dev/sdb4       654714880  1465141247   405213184    f  W95 Ext'd (LBA)
/dev/sdb5       654716928  1465141247   405212160    7  HPFS/NTFS/exFAT

已插入SD Card

handy@handy-dell ~ $ sudo fdisk -l
[sudo] password for handy: 

Disk /dev/sda: 240.1 GB, 240057409536 bytes
255 heads, 63 sectors/track, 29185 cylinders, total 468862128 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0f6535bd

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     1026047      512000    7  HPFS/NTFS/exFAT
/dev/sda2         1026048   264060927   131517440    7  HPFS/NTFS/exFAT
/dev/sda3       264060928   293357567    14648320   83  Linux
/dev/sda4       293359614   468860927    87750657    5  Extended
/dev/sda5       293359616   324607999    15624192   82  Linux swap / Solaris
/dev/sda6       324610048   468860927    72125440   83  Linux

Disk /dev/sdb: 750.2 GB, 750156374016 bytes
255 heads, 63 sectors/track, 91201 cylinders, total 1465149168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x9af12796

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1              63       80324       40131   de  Dell Utility
Partition 1 does not start on physical sector boundary.
/dev/sdb2   *       81920    25563135    12740608    7  HPFS/NTFS/exFAT
/dev/sdb3        25563136   654713009   314574937    7  HPFS/NTFS/exFAT
/dev/sdb4       654714880  1465141247   405213184    f  W95 Ext'd (LBA)
/dev/sdb5       654716928  1465141247   405212160    7  HPFS/NTFS/exFAT

Disk /dev/sdc: 8068 MB, 8068792320 bytes
249 heads, 62 sectors/track, 1020 cylinders, total 15759360 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x792515cc

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1            2048     2474609     1236281    c  W95 FAT32 (LBA)
/dev/sdc2         2474610    15759359     6642375    5  Extended
/dev/sdc5         2482176     2547709       32767   83  Linux
/dev/sdc6         2547712     2682879       67584    e  W95 FAT16 (LBA)
/dev/sdc7         2686976    15759359     6536192   83  Linux

兩相比較,多了 /dev/sdc(本例使用SD卡經USB讀卡機接PC,若SD卡直插PC卡槽,應被PC認為mmcblk0之類的名稱) 多了以下這一段描述

Disk /dev/sdc: 8068 MB, 8068792320 bytes
下略...

技巧:用grep濾一下,會清楚許多

handy@handy-dell ~ $ sudo fdisk -l | grep Disk
Disk /dev/sda: 240.1 GB, 240057409536 bytes
Disk identifier: 0x0f6535bd
Disk /dev/sdb: 750.2 GB, 750156374016 bytes
Disk identifier: 0x9af12796
Disk /dev/mmcblk0: 15.9 GB, 15931539456 bytes
Disk identifier: 0x00000000

找到目標後,接下來動手將/dev/sdc做fdisk,進入fdisk後,使用m指令叫出功能列表

handy@handy-dell ~ $ sudo fdisk /dev/sdc

Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

幾個會用到的操作為d(刪除),p(看分割表),n(新增)

經查分割表,有兩大塊,分別是主要的FAT32與延伸分割,把這兩塊刪除,則整塊SD卡就清了。

Command (m for help): p

Disk /dev/sdc: 8068 MB, 8068792320 bytes
249 heads, 62 sectors/track, 1020 cylinders, total 15759360 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x792515cc

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1            2048     2474609     1236281    c  W95 FAT32 (LBA)
/dev/sdc2         2474610    15759359     6642375    5  Extended
/dev/sdc5         2482176     2547709       32767   83  Linux
/dev/sdc6         2547712     2682879       67584    e  W95 FAT16 (LBA)
/dev/sdc7         2686976    15759359     6536192   83  Linux

Command (m for help): d
Partition number (1-7): 1

Command (m for help): p

Disk /dev/sdc: 8068 MB, 8068792320 bytes
249 heads, 62 sectors/track, 1020 cylinders, total 15759360 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x792515cc

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc2         2474610    15759359     6642375    5  Extended
/dev/sdc5         2482176     2547709       32767   83  Linux
/dev/sdc6         2547712     2682879       67584    e  W95 FAT16 (LBA)
/dev/sdc7         2686976    15759359     6536192   83  Linux

Command (m for help): d
Partition number (1-7): 2

清乾淨的效果

Command (m for help): p

Disk /dev/sdc: 8068 MB, 8068792320 bytes
249 heads, 62 sectors/track, 1020 cylinders, total 15759360 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x792515cc

   Device Boot      Start         End      Blocks   Id  System

破壞之後就是建設,建立新的主分割區,啟始/結束磁區沒有特別想法,用預設值

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
Partition number (1-4, default 1): 
Using default value 1
First sector (2048-15759359, default 2048): 
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-15759359, default 15759359): 
Using default value 15759359

Command (m for help): p

Disk /dev/sdc: 8068 MB, 8068792320 bytes
249 heads, 62 sectors/track, 1020 cylinders, total 15759360 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x792515cc

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1            2048    15759359     7878656   83  Linux

已成功建立分割區,但注意最後一行的System欄位為Linux,而樹莓需要的是FAT32的類型(?)

總之,使用t指令變更type

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): l

 0  Empty           24  NEC DOS         81  Minix / old Lin bf  Solaris        
 1  FAT12           27  Hidden NTFS Win 82  Linux swap / So c1  DRDOS/sec (FAT-
 2  XENIX root      39  Plan 9          83  Linux           c4  DRDOS/sec (FAT-
 3  XENIX usr       3c  PartitionMagic  84  OS/2 hidden C:  c6  DRDOS/sec (FAT-
 4  FAT16 <32M      40  Venix 80286     85  Linux extended  c7  Syrinx         
 5  Extended        41  PPC PReP Boot   86  NTFS volume set da  Non-FS data    
 6  FAT16           42  SFS             87  NTFS volume set db  CP/M / CTOS / .
 7  HPFS/NTFS/exFAT 4d  QNX4.x          88  Linux plaintext de  Dell Utility   
 8  AIX             4e  QNX4.x 2nd part 8e  Linux LVM       df  BootIt         
 9  AIX bootable    4f  QNX4.x 3rd part 93  Amoeba          e1  DOS access     
 a  OS/2 Boot Manag 50  OnTrack DM      94  Amoeba BBT      e3  DOS R/O        
 b  W95 FAT32       51  OnTrack DM6 Aux 9f  BSD/OS          e4  SpeedStor      
 c  W95 FAT32 (LBA) 52  CP/M            a0  IBM Thinkpad hi eb  BeOS fs        
 e  W95 FAT16 (LBA) 53  OnTrack DM6 Aux a5  FreeBSD         ee  GPT            
 f  W95 Ext'd (LBA) 54  OnTrackDM6      a6  OpenBSD         ef  EFI (FAT-12/16/
10  OPUS            55  EZ-Drive        a7  NeXTSTEP        f0  Linux/PA-RISC b
11  Hidden FAT12    56  Golden Bow      a8  Darwin UFS      f1  SpeedStor      
12  Compaq diagnost 5c  Priam Edisk     a9  NetBSD          f4  SpeedStor      
14  Hidden FAT16 <3 61  SpeedStor       ab  Darwin boot     f2  DOS secondary  
16  Hidden FAT16    63  GNU HURD or Sys af  HFS / HFS+      fb  VMware VMFS    
17  Hidden HPFS/NTF 64  Novell Netware  b7  BSDI fs         fc  VMware VMKCORE 
18  AST SmartSleep  65  Novell Netware  b8  BSDI swap       fd  Linux raid auto
1b  Hidden W95 FAT3 70  DiskSecure Mult bb  Boot Wizard hid fe  LANstep        
1c  Hidden W95 FAT3 75  PC/IX           be  Solaris boot    ff  BBT            
1e  Hidden W95 FAT1 80  Old Minix      
Hex code (type L to list codes): b
Changed system type of partition 1 to b (W95 FAT32)

變更type為 b W95 FAT32 ,再確認一下分割區,果然已變W95 FAT32了

Command (m for help): p

Disk /dev/sdc: 8068 MB, 8068792320 bytes
249 heads, 62 sectors/track, 1020 cylinders, total 15759360 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x792515cc

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1            2048    15759359     7878656    b  W95 FAT32

最終,將所做變更寫入到SD卡

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)

WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks.
handy@handy-dell ~ $

2) 格式化SD卡(要sudo,要 -I ?)

handy@handy-dell ~ $ sudo mkfs.vfat /dev/sdc
mkfs.fat 3.0.26 (2014-03-07)
mkfs.vfat: Device partition expected, not making filesystem on entire device '/dev/sdc' (use -I to override)
handy@handy-dell ~ $ sudo mkfs.vfat /dev/sdc -I
mkfs.fat 3.0.26 (2014-03-07)

某些情況下mkfs會抱怨操作權限不足,用-I參數做強制寫入。

若有無法掛載的情況,試一下重開機。或許會好。(linux mint 發生過的實例)

Linux handy-dell 3.19.0-32-generic #37~14.04.1-Ubuntu SMP Thu Oct 22 09:41:40 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

3) 下載官方NOOBS映像並解壓縮寫入SD卡

官網下載NOOBS後,算一下checksum,並比對官網提供的checksum,確認是同一個檔案

handy@handy-dell ~/Downloads $ shasum NOOBS_v2_1_0.zip 
c4eb9a8f1442bfa1eb8e357cb78980b3442afa87  NOOBS_v2_1_0.zip

找到SD卡掛載點(或是手動掛上?)若無法掛載,則確認格式化是否成功?

handy@handy-dell ~ $ mount | grep sdc
/dev/sdc on /media/handy/A917-2B7E type vfat (rw,nosuid,nodev,uid=1000,gid=1000,shortname=mixed,dmask=0077,utf8=1,showexec,flush,uhelper=udisks2)

使用unzip將NOOBS解壓縮並寫入SD卡。(注意unzip指令預設解壓縮到當前目錄,無需點號)

handy@handy-dell /media/handy/A917-2B7E $ unzip ~/Downloads/NOOBS_v2_1_0.zip 
Archive:  /home/handy/Downloads/NOOBS_v2_1_0.zip
  inflating: recovery.elf            
  inflating: recovery.rfs            
  inflating: bootcode.bin            
...下略

SD卡製作完成,將SD卡插入樹莓並上電跑安裝。

註:2017-03-02 SD卡插上樹莓後,樹莓認定未妥善格式化,樹莓幫格式化後,提示將SD卡回PC端重新放入NOOBS,再到樹莓重跑安裝程序後OK。

註:2017-04-24 嘗試安裝NOOBS_V2_4_0.zip無法安裝,樹莓3啟動畫面指示無法找到NOOBS檔案,而後將SD卡放回PC檢查,發現檔案已被移除。改安裝NOOBS_V2_2_0.zip後,可安裝。

results matching ""

    No results matching ""