Booting from SD/zh tw

From Openmoko

(Difference between revisions)
Jump to: navigation, search
(製作可開機的SD Card (GTA02))
(運作原理)
 
(14 intermediate revisions by one user not shown)
Line 12: Line 12:
 
在Neo中,我們使用 [[u-boot]] 做為bootloader。U-boot 負責硬體裝置的功能運作,直到 Openmoko被啟動載入裝置為止。首先,它會將kernel image載入記憶體中,接著再傳送一串參數到kernel。這些參數的工作是用來指定root filesystem的位置。
 
在Neo中,我們使用 [[u-boot]] 做為bootloader。U-boot 負責硬體裝置的功能運作,直到 Openmoko被啟動載入裝置為止。首先,它會將kernel image載入記憶體中,接著再傳送一串參數到kernel。這些參數的工作是用來指定root filesystem的位置。
  
在載入kernel 後,它會啟動硬體,並且掛載root filesystem。之後 kernel 會執行 "/sbin/init",它會處理其它的開機程序 ( 如顯示螢幕)。
+
在載入kernel 後,它會啟動硬體,並且掛載root filesystem。之後 kernel 會執行 "/sbin/init",它會處理其它的開機程序( 如顯示螢幕)。
  
不論是是使用內建的Flash開機,或者是使用SD開機,你所執行的開機順序將會相同。唯一不同的地方是載入 kernel 的方法,及哪個裝置被視為root filesystem,掛載到系統上。
+
不論是是使用內建的Flash開機,或者是使用SD Card開機,你所執行的開機順序將會相同。唯一不同的地方是載入 kernel 的方法,及哪個裝置被視為root filesystem,掛載到系統上。
  
  
 
===U-boot 歷史版本===
 
===U-boot 歷史版本===
 +
 
* 20080226 初版
 
* 20080226 初版
 
* 20080305 修復DFU,並且移除NOR版本,使用NAND功能
 
* 20080305 修復DFU,並且移除NOR版本,使用NAND功能
Line 24: Line 25:
  
 
而Neo FreeRunner在硬體設計上,提供了自NAND開機及自SD卡開機,不論您要使用哪種方式開機,開機程序都必須使用U-boot進行管理。
 
而Neo FreeRunner在硬體設計上,提供了自NAND開機及自SD卡開機,不論您要使用哪種方式開機,開機程序都必須使用U-boot進行管理。
 +
 +
而在Neo FreeRunner上,若您希望由SD卡中開機,您可以透過以下的步驟,達到這個目地。
 +
 +
:'''1. 製作可開機的SD卡。'''
 +
 +
:'''2. 在FreeRunner中置入SD卡。'''
 +
 +
:'''3. 選擇自SD卡開機,即可完成此項工作。'''
  
 
= 製作可開機的SD Card (GTA02) =
 
= 製作可開機的SD Card (GTA02) =
  
== Acquiring a tarfile rootfs ==
+
== 取得壓縮的 rootfs ==
  
There are two ways of acquiring an rootfs image as a tar archive. You can either build it on your own using the OpenEmbedded Distribution. Or download it from the Openmoko [http://downloads.openmoko.org downloads].
+
取得壓縮的rootfs image 有二種方法,你可以使用OpenEmbedded 建立它,或者自Openmoko [http://downloads.openmoko.org downloads]下載它。
  
  
=== Possibility 1: Downloading the rootfs/kernel tar from the Openmoko buildhost ===
+
=== 方法 1: 自Openmoko buildhost上下載rootfs/kernel 壓縮檔 ===
  
Choose and find the rootfs/kernel combo you would like to install at [[Latest Images]].
+
你可以自[[Latest Images|最近的影像檔]]選擇及找到一組 rootfs/kernel 組合
  
=== Possibility 2: Building a tarfile distribution using OpenEmbedded ===
+
=== 方法 2: 使用OpenEmbedded建立tarfile ===
  
Another possibility to get a tar archive of your rootfs is to build it on your own with the OpenEmbedded environment.
+
另一個取得 tar 壓縮檔的方法就是,你可以從OpenEmbedded 環境下建立此檔案。
  
To build OM-2007.2 you need to add "tar" to the image types in your ''local.conf'':
+
如要製作OM-2007.2 ,你必須在 ''local.conf''下加入"tar" 字樣:
  
 
  IMAGE_FSTYPES = "jffs2 tar"
 
  IMAGE_FSTYPES = "jffs2 tar"
  
After that build a new image by issuing:
+
之後,使用下列指令建立新的image:
 
   
 
   
 
  bitbake openmoko-devel-image
 
  bitbake openmoko-devel-image
  
or if you are using the MokoMakefile:
+
或者,你可以使用MokoMakefile:
 
   
 
   
 
  make openmoko-devel-image
 
  make openmoko-devel-image
  
After the process finished there will be a ''Openmoko-....tar'' in the deploy directory, which is your newly created rootfs archive
+
在完成了以上程序後,在配置的目錄下會有一個名為 ''Openmoko-....tar'' 的檔案,即為你所完成的rootfs
  
=== Possibility 3 : Convert a jff2 image to a tarfile ===
+
=== 方法 3 : 轉換 jff2 image為 tarfile ===
  
See [[Userspace root image]] for more details on how to access contents of a jffs2 image.
+
你可以參考[[Userspace root image]] 取如何存取 jffs2 image的詳細資訊。
  
 
+
== 製作可開機的SD 卡==
 
+
以下為自SD中啟動系統的操作步驟指引。它使用ubuntu 及一張乾淨的512 MB Sandisk microSD 卡:
 
+
*'''Step 1, 缷載磁碟:'''
 
+
以下為自SD中啟動系統的操作步驟指引。它使用ubuntu 及一張乾淨的512 MB Sandisk microSD 卡(FAT16 分割區格式的SD card):
+
 
+
*Step 1, 缷載磁碟:
+
 
    
 
    
 
   sudo umount /media/disk-1
 
   sudo umount /media/disk-1
  
{{note|由於個人使用的作業環境之不同, 所使用的磁碟代號將有所不同,建議您使用df指令查看您的磁碟代號}}
+
{{note|你可以使用fdisk -l 取得相關磁碟資訊}}
 
+
  
  
 
接著將磁碟分為二個分割區,第一個分割區使用vfat,預留 8MB空間給 uImage.bin,第二個磁區 (其餘的磁碟空間) 使用ext2 格式,提供給rootfs 檔案及目錄使用。二個分割區都使用primary partition 類型。
 
接著將磁碟分為二個分割區,第一個分割區使用vfat,預留 8MB空間給 uImage.bin,第二個磁區 (其餘的磁碟空間) 使用ext2 格式,提供給rootfs 檔案及目錄使用。二個分割區都使用primary partition 類型。
  
*Step 2, fdisk:
+
*'''Step 2, fdisk:'''
  
 
   sudo fdisk /dev/mmcblk0
 
   sudo fdisk /dev/mmcblk0
Line 106: Line 110:
 
{{note|由於個人使用的作業環境之不同, 所使用的代號將有所不同,建議您使用df指令查看您的磁碟代號}}
 
{{note|由於個人使用的作業環境之不同, 所使用的代號將有所不同,建議您使用df指令查看您的磁碟代號}}
  
*Step 3 Format:
+
*Step 3 格式化SD卡:
  
Format 2 volume with vfat (uImage.bin) and ext2 (rootfs files)
+
請將二個分割區分別格式化為 vfat (放置uImage.bin)ext2 (放置 rootfs files)
  
 
   mkfs -t vfat /dev/mmcblk0p1
 
   mkfs -t vfat /dev/mmcblk0p1
Line 115: Line 119:
  
  
*Step 4 Copy kernel and rootfs files into 2 volume:
+
*Step 4 將kernel及rootfs 檔案放置到二個分割區中:
  
uImage.bin 為量產所使用的映像檔。uImage則為較早期所使用的元件(DVT4/PVT1)。你必須壓縮 xvzf rootfs.tar.gz 以取得所有的檔案。
+
你必須使用以下指令解壓縮
 +
 
 +
mount /dev/mmcblk0p2 /mnt/moko
 +
tar -C /mnt/moko/ -xzvf openmoko-devel-image-fic-gta01-20070313022035.rootfs.tar.gz
  
 
   sudo cp -r /home/tony/Desktop/kernel/uImage.bin /media/disk-1
 
   sudo cp -r /home/tony/Desktop/kernel/uImage.bin /media/disk-1
Line 125: Line 132:
 
   sync
 
   sync
  
*Step 5 自Neo的選單中,選擇 boot from SD (在正確的 u-boot_env 內容下)
+
*Step 5 自Neo的選單中,選擇 '''boot from SD'''
  
=開機環境 (GTA02)=
 
  
在GTA02 NAND下有六個分割區。
 
 
* 1. u-boot.bin
 
* 2. u-boot_env
 
* 3. kernel (uImage.bin)
 
* 4. splash.gz (splash screen)
 
* 5. Factory (BT/WLAN/Serial...etc)
 
* 6. rootfs
 
 
預設的GTA02 env 檔案最原始的版本(2008/7)可以在下面的位址找到 [http://people.openmoko.org/tony_tu/GTA02/images/20080424_gta02_release/env-5secs.env 預設env檔]
 
 
你可以使用下面的 env.new 檔案,在開機畫面中加入 boot from sd 功能選項。  [http://people.openmoko.org/tony_tu/GTA02/images/env_files/env.new u-boot environment].
 
 
* ./dfu-util -a u-boot_env -R -D env.new
 
  
 
=自NOR (GTA02)下開機=
 
=自NOR (GTA02)下開機=
Line 156: Line 148:
 
* 使用NOR開機畫面自SD卡開機
 
* 使用NOR開機畫面自SD卡開機
  
=自NAND下開機 (GTA02)=
+
 
  
 
[[Category:Flashing Openmoko/zh tw]]
 
[[Category:Flashing Openmoko/zh tw]]
 
[[Category:System Developers/zh tw]]
 
[[Category:System Developers/zh tw]]

Latest revision as of 05:18, 16 January 2009


Editing: (30, Dec, 2008) This page is being edited by coolcat: 本網頁目前正在加強內容編輯中

If this note persists without edits in the history, feel free to remove the Editing template from the page.



[edit] 運作原理

Openmoko GTA02 支援雙系統開機。除了將映像檔燒錄到您的NAND外,你也可以利用將其它套件放在SD卡的方法,使用SD卡開機,載入另一個套件系統。

在Neo中,我們使用 u-boot 做為bootloader。U-boot 負責硬體裝置的功能運作,直到 Openmoko被啟動載入裝置為止。首先,它會將kernel image載入記憶體中,接著再傳送一串參數到kernel。這些參數的工作是用來指定root filesystem的位置。

在載入kernel 後,它會啟動硬體,並且掛載root filesystem。之後 kernel 會執行 "/sbin/init",它會處理其它的開機程序( 如顯示螢幕)。

不論是是使用內建的Flash開機,或者是使用SD Card開機,你所執行的開機順序將會相同。唯一不同的地方是載入 kernel 的方法,及哪個裝置被視為root filesystem,掛載到系統上。


[edit] U-boot 歷史版本

  • 20080226 初版
  • 20080305 修復DFU,並且移除NOR版本,使用NAND功能
  • 20080312 修復自SD記憶卡啟動功能 (從使用uImage 改為使用uImage.bin)
  • 20080320 修復u-boot direct drawing 500mA 、智慧充電、量產版本。

而Neo FreeRunner在硬體設計上,提供了自NAND開機及自SD卡開機,不論您要使用哪種方式開機,開機程序都必須使用U-boot進行管理。

而在Neo FreeRunner上,若您希望由SD卡中開機,您可以透過以下的步驟,達到這個目地。

1. 製作可開機的SD卡。
2. 在FreeRunner中置入SD卡。
3. 選擇自SD卡開機,即可完成此項工作。

[edit] 製作可開機的SD Card (GTA02)

[edit] 取得壓縮的 rootfs

取得壓縮的rootfs image 有二種方法,你可以使用OpenEmbedded 建立它,或者自Openmoko downloads下載它。


[edit] 方法 1: 自Openmoko buildhost上下載rootfs/kernel 壓縮檔

你可以自最近的影像檔選擇及找到一組 rootfs/kernel 組合

[edit] 方法 2: 使用OpenEmbedded建立tarfile

另一個取得 tar 壓縮檔的方法就是,你可以從OpenEmbedded 環境下建立此檔案。

如要製作OM-2007.2 ,你必須在 local.conf下加入"tar" 字樣:

IMAGE_FSTYPES = "jffs2 tar"

之後,使用下列指令建立新的image:

bitbake openmoko-devel-image

或者,你可以使用MokoMakefile:

make openmoko-devel-image

在完成了以上程序後,在配置的目錄下會有一個名為 Openmoko-....tar 的檔案,即為你所完成的rootfs

[edit] 方法 3 : 轉換 jff2 image為 tarfile

你可以參考Userspace root image 取如何存取 jffs2 image的詳細資訊。

[edit] 製作可開機的SD 卡

以下為自SD中啟動系統的操作步驟指引。它使用ubuntu 及一張乾淨的512 MB Sandisk microSD 卡:

  • Step 1, 缷載磁碟:
  sudo umount /media/disk-1
NOTE: 你可以使用fdisk -l 取得相關磁碟資訊



接著將磁碟分為二個分割區,第一個分割區使用vfat,預留 8MB空間給 uImage.bin,第二個磁區 (其餘的磁碟空間) 使用ext2 格式,提供給rootfs 檔案及目錄使用。二個分割區都使用primary partition 類型。

  • Step 2, fdisk:
  sudo fdisk /dev/mmcblk0
  Command (m for help): d
  Selected partition 1
  Command (m for help): n
  Command action
     e   extended
     p   primary partition (1-4)
  p
  Partition number (1-4): 1
  First cylinder (1-983, default 1):
  Using default value 1
  Last cylinder or +size or +sizeM or +sizeK (1-983, default 983): +8M
  Command (m for help): n
  Command action
     e   extended
     p   primary partition (1-4)
  p
  Partition number (1-4): 2
  First cylinder (18-983, default 18):
  Using default value 18
  Last cylinder or +size or +sizeM or +sizeK (18-983, default 983):
  Using default value 983
  Command (m for help): w
  The partition table has been altered!
  Calling ioctl() to re-read partition table.
  Syncing disks.
NOTE: 由於個人使用的作業環境之不同, 所使用的代號將有所不同,建議您使用df指令查看您的磁碟代號


  • Step 3 格式化SD卡:

請將二個分割區分別格式化為 vfat (放置uImage.bin)及 ext2 (放置 rootfs files)

  mkfs -t vfat /dev/mmcblk0p1
  mkfs -t ext2 /dev/mmcblk0p2


  • Step 4 將kernel及rootfs 檔案放置到二個分割區中:

你必須使用以下指令解壓縮

mount /dev/mmcblk0p2 /mnt/moko
tar -C /mnt/moko/ -xzvf openmoko-devel-image-fic-gta01-20070313022035.rootfs.tar.gz
  sudo cp -r /home/tony/Desktop/kernel/uImage.bin /media/disk-1
  sudo cp -r /home/tony/Desktop/root_files/. /media/disk-2
  sync
  • Step 5 自Neo的選單中,選擇 boot from SD


[edit] 自NOR (GTA02)下開機

如果你想要自NOR下開機,並且從SD卡中使用NOR,請使用下列的操作步驟。

  • 按下AUX key
  • 再按住Power,啟動GTA02
  • 約一秒後放開AUX

接著,你可以進入預設的NOR開機選單,你可以:

  • 使用NOR開機,使用DFU
  • 使用NOR開機畫面自SD卡開機
Personal tools


Editing: (30, Dec, 2008) This page is being edited by coolcat: 本網頁目前正在加強內容編輯中

If this note persists without edits in the history, feel free to remove the Editing template from the page.



運作原理

Openmoko GTA02 支援雙系統開機。除了將映像檔燒錄到您的NAND外,你也可以利用將其它套件放在SD卡的方法,使用SD卡開機,載入另一個套件系統。

在Neo中,我們使用 u-boot 做為bootloader。U-boot 負責硬體裝置的功能運作,直到 Openmoko被啟動載入裝置為止。首先,它會將kernel image載入記憶體中,接著再傳送一串參數到kernel。這些參數的工作是用來指定root filesystem的位置。

在載入kernel 後,它會啟動硬體,並且掛載root filesystem。之後 kernel 會執行 "/sbin/init",它會處理其它的開機程序 ( 如顯示螢幕)。

不論是是使用內建的Flash開機,或者是使用SD開機,你所執行的開機順序將會相同。唯一不同的地方是載入 kernel 的方法,及哪個裝置被視為root filesystem,掛載到系統上。


U-boot 歷史版本

  • 20080226 初版
  • 20080305 修復DFU,並且移除NOR版本,使用NAND功能
  • 20080312 修復自SD記憶卡啟動功能 (從使用uImage 改為使用uImage.bin)
  • 20080320 修復u-boot direct drawing 500mA 、智慧充電、量產版本。

而Neo FreeRunner在硬體設計上,提供了自NAND開機及自SD卡開機,不論您要使用哪種方式開機,開機程序都必須使用U-boot進行管理。

製作可開機的SD Card (GTA02)

Acquiring a tarfile rootfs

There are two ways of acquiring an rootfs image as a tar archive. You can either build it on your own using the OpenEmbedded Distribution. Or download it from the Openmoko downloads.


Possibility 1: Downloading the rootfs/kernel tar from the Openmoko buildhost

Choose and find the rootfs/kernel combo you would like to install at Latest Images.

Possibility 2: Building a tarfile distribution using OpenEmbedded

Another possibility to get a tar archive of your rootfs is to build it on your own with the OpenEmbedded environment.

To build OM-2007.2 you need to add "tar" to the image types in your local.conf:

IMAGE_FSTYPES = "jffs2 tar"

After that build a new image by issuing:

bitbake openmoko-devel-image

or if you are using the MokoMakefile:

make openmoko-devel-image

After the process finished there will be a Openmoko-....tar in the deploy directory, which is your newly created rootfs archive

Possibility 3 : Convert a jff2 image to a tarfile

See Userspace root image for more details on how to access contents of a jffs2 image.



以下為自SD中啟動系統的操作步驟指引。它使用ubuntu 及一張乾淨的512 MB Sandisk microSD 卡(FAT16 分割區格式的SD card):

  • Step 1, 缷載磁碟:
  sudo umount /media/disk-1
NOTE: 由於個人使用的作業環境之不同, 所使用的磁碟代號將有所不同,建議您使用df指令查看您的磁碟代號



接著將磁碟分為二個分割區,第一個分割區使用vfat,預留 8MB空間給 uImage.bin,第二個磁區 (其餘的磁碟空間) 使用ext2 格式,提供給rootfs 檔案及目錄使用。二個分割區都使用primary partition 類型。

  • Step 2, fdisk:
  sudo fdisk /dev/mmcblk0
  Command (m for help): d
  Selected partition 1
  Command (m for help): n
  Command action
     e   extended
     p   primary partition (1-4)
  p
  Partition number (1-4): 1
  First cylinder (1-983, default 1):
  Using default value 1
  Last cylinder or +size or +sizeM or +sizeK (1-983, default 983): +8M
  Command (m for help): n
  Command action
     e   extended
     p   primary partition (1-4)
  p
  Partition number (1-4): 2
  First cylinder (18-983, default 18):
  Using default value 18
  Last cylinder or +size or +sizeM or +sizeK (18-983, default 983):
  Using default value 983
  Command (m for help): w
  The partition table has been altered!
  Calling ioctl() to re-read partition table.
  Syncing disks.
NOTE: 由於個人使用的作業環境之不同, 所使用的代號將有所不同,建議您使用df指令查看您的磁碟代號


  • Step 3 Format:

Format 2 volume with vfat (uImage.bin) and ext2 (rootfs files)

  mkfs -t vfat /dev/mmcblk0p1
  mkfs -t ext2 /dev/mmcblk0p2


  • Step 4 Copy kernel and rootfs files into 2 volume:

uImage.bin 為量產所使用的映像檔。uImage則為較早期所使用的元件(DVT4/PVT1)。你必須壓縮 xvzf rootfs.tar.gz 以取得所有的檔案。

  sudo cp -r /home/tony/Desktop/kernel/uImage.bin /media/disk-1
  sudo cp -r /home/tony/Desktop/root_files/. /media/disk-2
  sync
  • Step 5 自Neo的選單中,選擇 boot from SD (在正確的 u-boot_env 內容下)

開機環境 (GTA02)

在GTA02 NAND下有六個分割區。

  • 1. u-boot.bin
  • 2. u-boot_env
  • 3. kernel (uImage.bin)
  • 4. splash.gz (splash screen)
  • 5. Factory (BT/WLAN/Serial...etc)
  • 6. rootfs

預設的GTA02 env 檔案最原始的版本(2008/7)可以在下面的位址找到 預設env檔

你可以使用下面的 env.new 檔案,在開機畫面中加入 boot from sd 功能選項。 u-boot environment.

  • ./dfu-util -a u-boot_env -R -D env.new

自NOR (GTA02)下開機

如果你想要自NOR下開機,並且從SD卡中使用NOR,請使用下列的操作步驟。

  • 按下AUX key
  • 再按住Power,啟動GTA02
  • 約一秒後放開AUX

接著,你可以進入預設的NOR開機選單,你可以:

  • 使用NOR開機,使用DFU
  • 使用NOR開機畫面自SD卡開機

自NAND下開機 (GTA02)