How to port Ubuntu 11.10 to Beagleboard 怎樣移植Ubuntu 11.10 到BeagleBoard

How to port Ubuntu to Beagleboard 怎樣移植Ubuntu到BeagleBoard


This note followed article named BeagleBoardUbuntu located at http://elinux.org/BeagleBoardUbuntu

Following method 1 in that article: Download a Complete Pre-Configured Image.

For your reference, here we show the kernel information of this Ubuntu 11.10 after porting in advance:

[plain] view plaincopy
  1. ubuntu@omap:~$ cat /proc/version  
  2. Linux version 3.2.3 - x4 (root@panda - a3 - lgb) (gcc version 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3) #1 SMP Fri Feb 24 23:33:25 UTC 2012  


1.Get prebuilt image: 

[plain] view plaincopy
  1. a4@a4-390:~/beagleXmUbuntu11.10$ wget http://rcn-ee.net/deb/rootfs/oneiric/ubuntu-11.10-r5-minimal-armel.tar.xz  
  2. --2012-02-24 09:14:12--  http://rcn-ee.net/deb/rootfs/oneiric/ubuntu-11.10-r5-minimal-armel.tar.xz  
  3. Resolving rcn-ee.net... 69.163.149.169  
  4. Connecting to rcn-ee.net|69.163.149.169|:80... connected.  
  5. HTTP request sent, awaiting response... 200 OK  
  6. Length: 113276232 (108M) [application/x-tar]  
  7. Saving to: `ubuntu-11.10-r5-minimal-armel.tar.xz'  
  8.   
  9. 100%[======================================>] 113,276,232  592K/s   in 3m 10s    
  10.   
  11. 2012-02-24 09:17:24 (581 KB/s) - `ubuntu-11.10-r5-minimal-armel.tar.xz' saved [113276232/113276232]  


2.Verify Image with: 
[plain] view plaincopy
  1. a4@a4-390:~/beagleXmUbuntu11.10$ md5sum ubuntu-11.10-r5-minimal-armel.tar.xz  
  2. dc38df885797c2db3a8fc8265463a43b  ubuntu-11.10-r5-minimal-armel.tar.xz  
  3.   
  4. 3.Unpack Image:  
  5. a4@a4-390:~/beagleXmUbuntu11.10$ tar xJf ubuntu-11.10-r5-minimal-armel.tar.xz  
  6. a4@a4-390:~/beagleXmUbuntu11.10$ ls  
  7. ubuntu-11.10-r5-minimal-armel  ubuntu-11.10-r5-minimal-armel.tar.xz  
  8. a4@a4-390:~/beagleXmUbuntu11.10$ cd ubuntu-11.10-r5-minimal-armel/  


4.If you don't know the location of your SD card: 
[plain] view plaincopy
  1. a4@a4-390:~/beagleXmUbuntu11.10/ubuntu-11.10-r5-minimal-armel$ sudo ./setup_sdcard.sh --probe-mmc  
  2. [sudo] password for a4:  
  3.   
  4. Are you sure? I Don't see [/dev/idontknow], here is what I do see...  
  5.   
  6. fdisk -l:  
  7. Disk /dev/sda: 3951 MB, 3951034368 bytes       <---this one is SD card  
  8. Disk /dev/sde: 146.8 GB, 146815733760 bytes  
  9.   
  10. mount:  
  11. /dev/sde1 on / type ext4 (rw,errors=remount-ro,commit=0)  
  12. devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)  
  13. /dev/sde6 on /home type ext4 (rw,commit=0)  
  14. /dev/sda1 on /media/b81a4017-ceba-4a04-9485-05421ddeed13 type ext4 (rw,nosuid,nodev,uhelper=udisks)  


5.Quick Install script for "board"

sudo ./setup_sdcard.sh --mmc /dev/sdX --uboot "board"

"board" Options:

    BeagleBoard Ax/Bx - beagle_bx
    BeagleBoard Cx - beagle_cx
    BeagleBoard xMA/B/C - beagle_xm
    BeagleBone Ax - bone
    PandaBoard Ax - panda
    PandaBoard ES - panda_es 
So For the BeagleBoard xM:
[plain] view plaincopy
  1. a4@a4-390:~/beagleXmUbuntu11.10/ubuntu-11.10-r5-minimal-armel$ sudo ./setup_sdcard.sh --mmc /dev/sda --uboot beagle_xm  


從附錄可以看到,這個過程共從網絡下載了約100MB文件。
安裝的關鍵在於腳本文件setup_sdcard.sh,附錄貼上了該文件。具體要知道怎樣一步一步移植Ubuntu,請參考文章“BeagleBoardUbuntu”的方法三“Manual Install (no automatic scripts)”,看看怎樣移植x-loader (MLO, 44.1 KB),u-boot (330.4 KB),kernel (uImage, 3 MB),filesystem到SD卡上。

6.Unmount the SD card from the PC, insert into beaglebaord-xm, reboot the board and have OS loaded showed via DVI displayer. Can operate unbuntu via USB keyboard through command line.
此時啓動的系統只是基本的Ubuntu系統,並沒有安裝圖形桌面。
下一步驟操作在beagleboard-xm上的ubuntu(ubuntu@omap)命令行進行,ubuntu輸出設備爲tty1,即輸出設備爲連接的DVI接口顯示器,串口無數據。初始默認非根用戶,用戶名爲ubuntu,密碼爲temppwd。
ubuntu@omap:~$ pwd
/home/ubuntu
由於xm加載的是新近ubuntu系統,安裝軟件不需要自己解決包依賴的問題,並且可以像操作檯式機ubuntu一樣使用各種命令。

7.Install kunbuntu desktop
先通過有線或無線把xm連接上網絡,通過ifconfig指令查看網絡配置信息,並可通過網絡安裝一個小程序來確認xm網絡是否通暢。
[plain] view plaincopy
  1. for Ethernet:  
  2. ubuntu@omap:~$ sudo ifconfig -a  
  3.   
  4. ubuntu@omap:~$ sudo apt-get update  
  5. No return, nothing installed, cann't find source.  
  6.   
  7. sudo apt-get install gdm xubuntu-desktop  


提示:
[plain] view plaincopy
  1. Need to get 41.5 MB/429 MB of archives.  
  2. After this operation, 1,367 MB of additional space will be used.  


前文臺式機下載的速度可達1MB/s,這裏xm有線下載速度最高達220KB/s
2分鐘後,DVI顯示器無信號,但xm的LED顯示xm尚在繁忙工作,這是由於長時間沒有鍵盤輸入,Ubuntu關閉了顯示器。按任一鍵可以重新顯示命令好界面。安裝過程如果有提示依賴包沒有安裝,按照提示進行安裝,採用sudo apt-get install xxxx方式很容易安裝。

本次安裝沒有正常接收到的deb大約有10個,系統提示:
[plain] view plaincopy
  1. ...  
  2. Failed to fetch http://ports.ubuntu.com/ubuntu-ports/pool/main/u/update-manager_0.152.25.5_all.deb 404 Not Found  
  3. E:Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?  
  4. ubuntu@omap:~$  


按照提示繼續安裝
[plain] view plaincopy
  1. ubuntu@omap:~$ sudo apt-get update  
  2. [sudo] password for Ubuntu:  
  3. Ign http://ports.ubuntu.com/ oneiric InRelease  
  4. ...  
  5. Fetched 618 KB in 15s (40.7 KB/s)  
  6. Reading package lists... Done  
  7. ubuntu@omap:~$  



再次運行
[plain] view plaincopy
  1. sudo apt-get install gdm xubuntu-desktop  


安裝重新開始,中間有一步需要爲圖形界面方式來選擇安裝的桌面系統。
xm先下載所有的包文件,然後在執行編譯和安裝,這種在目標機上直接編譯安裝的方式,優點是解決了Ubuntu交叉編譯非常困難的問題,不足是編譯時間長達數十個小時,尚且還不能用鏡像文件的方式複製系統文件。

最後,編譯完成
[plain] view plaincopy
  1. ...  
  2. update-initramfs: Generating /boot/initd.img-3.2.3-x4  
  3. ubuntu@omap:~$ sudo shutdown -r now  


重新啓動後,系統進入圖形登錄界面,同樣使用用戶名爲ubuntu,密碼爲temppwd登錄。進入基於xbuntu的XFCE4.8桌面系統。默認顯示器分辨率爲1280x720,本次實驗修改了該參數,修改方法爲:把SD插入到PC中,打開uEnv.txt文件,修改1280x720MR-16@60爲dvimode=1280x800MR-16@60。


  1. bootfile=uImage  
  2. bootinitrd=uInitrd  
  3. address_uimage=0x80300000  
  4. address_uinitrd=0x81600000  
  5.   
  6. vram=12MB  
  7.   
  8. console=ttyO2,115200n8  
  9.   
  10. defaultdisplay=dvi  
  11. dvimode=1280x800MR-16@60  
  12.   
  13. mmcroot=/dev/mmcblk0p2 ro  
  14. mmcrootfstype=ext4 rootwait fixrtc  
  15. optargs=console=tty0  
  16.   
  17. mmc_load_uimage=fatload mmc 0:1 ${address_uimage} ${bootfile}  
  18. mmc_load_uinitrd=fatload mmc 0:1 ${address_uinitrd} ${bootinitrd}  
  19.   
  20. mmcargs=setenv bootargs console=${console} ${optargs} mpurate=${mpurate} buddy=${buddy} buddy2=${buddy2} camera=${camera} vram=${vram} omapfb.mode=${defaultdisplay}:${dvimode} omapdss.def_disp=${defaultdisplay} root=${mmcroot} rootfstype=${mmcrootfstype}  
  21.   
  22. loaduimage=run mmc_load_uimage; run mmc_load_uinitrd; echo Booting from mmc ...; run mmcargs; bootm ${address_uimage} ${address_uinitrd}  



 [Appenidex] Install process of setup_sdcard.sh


a4@a4-390:~/beagleXmUbuntu11.10/ubuntu-11.10-r5-minimal-armel$ sudo ./setup_sdcard.sh --mmc /dev/sda --uboot beagle_xm
[plain] view plaincopy
  1. Are you 100% sure, on selecting [/dev/sda] (y/n)? y  
  2.   
  3.   
  4. Downloading Device's Bootloader  
  5. -----------------------------  
  6.   
  7. rcn-ee.net down, using mirror  
  8. -----------------------------  
  9. 2012-02-24 09:24:22 URL:http://rcn-ee.homeip.net:81/dl/mirrors/deb/tools/latest/bootloader [4652/4652] -> "/tmp/tmp.YjmRll9n0E/dl/bootloader" [1]  
  10. 2012-02-24 09:24:24 URL:http://rcn-ee.homeip.net:81/dl/mirrors/deb/tools/beagleboard/MLO-beagleboard-v2011.12-r1 [44104/44104] -> "/tmp/tmp.YjmRll9n0E/dl/MLO-beagleboard-v2011.12-r1" [1]  
  11. SPL Bootloader: MLO-beagleboard-v2011.12-r1  
  12. 2012-02-24 09:24:35 URL:http://rcn-ee.homeip.net:81/dl/mirrors/deb/tools/beagleboard/u-boot-beagleboard-v2011.12-r1.img [330372/330372] -> "/tmp/tmp.YjmRll9n0E/dl/u-boot-beagleboard-v2011.12-r1.img" [1]  
  13. UBOOT Bootloader: u-boot-beagleboard-v2011.12-r1.img  
  14.   
  15. Unmounting Partitions  
  16. -----------------------------  
  17.   
  18. Using fdisk to create BOOT Partition  
  19. -----------------------------  
  20.   
  21. WARNING: DOS-compatible mode is deprecated. It's strongly recommended to  
  22.          switch off the mode (with command 'c').  
  23. WARNING: cylinders as display units are deprecated. Use command 'u' to  
  24.          change units to sectors.  
  25.   
  26. Command (m for help): Command action  
  27.    e   extended  
  28.    p   primary partition (1-4)  
  29. Partition number (1-4, default 1): First cylinder (1-1020, default 1): Last cylinder, +cylinders or +size{K,M,G} (1-1020, default 1020):  
  30. Command (m for help): Selected partition 1  
  31. Hex code (type L to list codes): Changed system type of partition 1 to e (W95 FAT16 (LBA))  
  32.   
  33. Command (m for help):  
  34. Disk /dev/sda: 3951 MB, 3951034368 bytes  
  35. 122 heads, 62 sectors/track, 1020 cylinders  
  36. Units = cylinders of 7564 * 512 = 3872768 bytes  
  37. Sector size (logical/physical): 512 bytes / 512 bytes  
  38. I/O size (minimum/optimal): 512 bytes / 512 bytes  
  39. Disk identifier: 0x000a824e  
  40.   
  41.    Device Boot      Start         End      Blocks   Id  System  
  42. /dev/sda1               1          18       68045    e  W95 FAT16 (LBA)  
  43.   
  44. Command (m for help): The partition table has been altered!  
  45.   
  46. Calling ioctl() to re-read partition table.  
  47.   
  48. WARNING: If you have created or modified any DOS 6.x  
  49. partitions, please see the fdisk manual page for additional  
  50. information.  
  51. Syncing disks.  
  52. Setting Boot Partition's Boot Flag  
  53. -----------------------------  
  54. Creating rootfs ext4 Partition  
  55. -----------------------------  
  56. Formating Boot Partition  
  57. -----------------------------  
  58. mkfs.vfat 3.0.9 (31 Jan 2010)  
  59. Formating rootfs Partition as ext4  
  60. -----------------------------  
  61. mke2fs 1.41.14 (22-Dec-2010)  
  62. Filesystem label=rootfs  
  63. OS type: Linux  
  64. Block size=4096 (log=2)  
  65. Fragment size=4096 (log=2)  
  66. Stride=0 blocks, Stripe width=0 blocks  
  67. 237104 inodes, 947391 blocks  
  68. 47369 blocks (5.00%) reserved for the super user  
  69. First data block=0  
  70. Maximum filesystem blocks=973078528  
  71. 29 block groups  
  72. 32768 blocks per group, 32768 fragments per group  
  73. 8176 inodes per group  
  74. Superblock backups stored on blocks:  
  75.     32768, 98304, 163840, 229376, 294912, 819200, 884736  
  76.   
  77. Writing inode tables: done                              
  78. Creating journal (16384 blocks): done  
  79. Writing superblocks and filesystem accounting information: done  
  80.   
  81. This filesystem will be automatically checked every 24 mounts or  
  82. 180 days, whichever comes first.  Use tune2fs -c or -i to override.  
  83. Populating Boot Partition  
  84. -----------------------------  
  85. `/tmp/tmp.YjmRll9n0E/dl/MLO-beagleboard-v2011.12-r1' -> `/tmp/tmp.YjmRll9n0E/disk/MLO'  
  86. `/tmp/tmp.YjmRll9n0E/dl/u-boot-beagleboard-v2011.12-r1.img' -> `/tmp/tmp.YjmRll9n0E/disk/u-boot.img'  
  87. Using mkimage to create uImage  
  88. -----------------------------  
  89. Image Name:   3.2.3-x4  
  90. Created:      Fri Feb 24 09:26:28 2012  
  91. Image Type:   ARM Linux Kernel Image (uncompressed)  
  92. Data Size:    3014464 Bytes = 2943.81 kB = 2.87 MB  
  93. Load Address: 80008000  
  94. Entry Point:  80008000  
  95. Using mkimage to create uInitrd  
  96. -----------------------------  
  97. Image Name:   initramfs  
  98. Created:      Fri Feb 24 09:26:30 2012  
  99. Image Type:   ARM Linux RAMDisk Image (uncompressed)  
  100. Data Size:    3087289 Bytes = 3014.93 kB = 2.94 MB  
  101. Load Address: 00000000  
  102. Entry Point:  00000000  
  103. Copying uEnv.txt based boot scripts to Boot Partition  
  104. -----------------------------  
  105. `/tmp/tmp.YjmRll9n0E/bootscripts/normal.cmd' -> `/tmp/tmp.YjmRll9n0E/disk/uEnv.txt'  
  106. bootfile=uImage  
  107. bootinitrd=uInitrd  
  108. address_uimage=0x80300000  
  109. address_uinitrd=0x81600000  
  110.   
  111. vram=12MB  
  112.   
  113. console=ttyO2,115200n8  
  114.   
  115. defaultdisplay=dvi  
  116. dvimode=1280x720MR-16@60  
  117.   
  118. mmcroot=/dev/mmcblk0p2 ro  
  119. mmcrootfstype=ext4 rootwait fixrtc  
  120. optargs=console=tty0  
  121.   
  122. mmc_load_uimage=fatload mmc 0:1 ${address_uimage} ${bootfile}  
  123. mmc_load_uinitrd=fatload mmc 0:1 ${address_uinitrd} ${bootinitrd}  
  124.   
  125. mmcargs=setenv bootargs console=${console} ${optargs} mpurate=${mpurate} buddy=${buddy} buddy2=${buddy2} camera=${camera} vram=${vram} omapfb.mode=${defaultdisplay}:${dvimode} omapdss.def_disp=${defaultdisplay} root=${mmcroot} rootfstype=${mmcrootfstype}  
  126.   
  127. loaduimage=run mmc_load_uimage; run mmc_load_uinitrd; echo Booting from mmc ...; run mmcargs; bootm ${address_uimage} ${address_uinitrd}  
  128. -----------------------------  
  129. `/tmp/tmp.YjmRll9n0E/readme.txt' -> `/tmp/tmp.YjmRll9n0E/disk/tools/readme.txt'  
  130. `/tmp/tmp.YjmRll9n0E/update_boot_files.sh' -> `/tmp/tmp.YjmRll9n0E/disk/tools/update_boot_files.sh'  
  131. `/tmp/tmp.YjmRll9n0E/minimal_xfce.sh' -> `/tmp/tmp.YjmRll9n0E/disk/tools/minimal_xfce.sh'  
  132. `/tmp/tmp.YjmRll9n0E/get_chrome.sh' -> `/tmp/tmp.YjmRll9n0E/disk/tools/get_chrome.sh'  
  133. Finished populating Boot Partition  
  134. -----------------------------  
  135. Populating rootfs Partition  
  136. Please be patient, this may take a few minutes, as its transfering a lot of files..  
  137. -----------------------------  
  138.  383MB 0:06:22 [   1MB/s] [==================================>] 100%              
  139. Transfer of Base Rootfs Complete, syncing to disk  
  140. -----------------------------  
  141. Ubuntu: with no eth cable connected it can take up to 2 mins to login, removing upstart sleep call  
  142. -----------------------------  
  143. Ubuntu: to unfix: sudo sed -i -e 's:#sleep 40:sleep 40:g' /etc/init/failsafe.conf  
  144. Ubuntu: to unfix: sudo sed -i -e 's:#sleep 59:sleep 59:g' /etc/init/failsafe.conf  
  145. -----------------------------  
  146. Finished populating rootfs Partition  
  147. -----------------------------  
  148. setup_sdcard.sh script complete  
[plain] view plaincopy
  1. a4@a4-390:~/beagleXmUbuntu11.10/ubuntu-11.10-r5-minimal-armel$   
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章