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:
- ubuntu@omap:~$ cat /proc/version
- 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:
- a4@a4-390:~/beagleXmUbuntu11.10$ wget http://rcn-ee.net/deb/rootfs/oneiric/ubuntu-11.10-r5-minimal-armel.tar.xz
- --2012-02-24 09:14:12-- http://rcn-ee.net/deb/rootfs/oneiric/ubuntu-11.10-r5-minimal-armel.tar.xz
- Resolving rcn-ee.net... 69.163.149.169
- Connecting to rcn-ee.net|69.163.149.169|:80... connected.
- HTTP request sent, awaiting response... 200 OK
- Length: 113276232 (108M) [application/x-tar]
- Saving to: `ubuntu-11.10-r5-minimal-armel.tar.xz'
- 100%[======================================>] 113,276,232 592K/s in 3m 10s
- 2012-02-24 09:17:24 (581 KB/s) - `ubuntu-11.10-r5-minimal-armel.tar.xz' saved [113276232/113276232]
2.Verify Image with:
- a4@a4-390:~/beagleXmUbuntu11.10$ md5sum ubuntu-11.10-r5-minimal-armel.tar.xz
- dc38df885797c2db3a8fc8265463a43b ubuntu-11.10-r5-minimal-armel.tar.xz
- 3.Unpack Image:
- a4@a4-390:~/beagleXmUbuntu11.10$ tar xJf ubuntu-11.10-r5-minimal-armel.tar.xz
- a4@a4-390:~/beagleXmUbuntu11.10$ ls
- ubuntu-11.10-r5-minimal-armel ubuntu-11.10-r5-minimal-armel.tar.xz
- a4@a4-390:~/beagleXmUbuntu11.10$ cd ubuntu-11.10-r5-minimal-armel/
4.If you don't know the location of your SD card:
- a4@a4-390:~/beagleXmUbuntu11.10/ubuntu-11.10-r5-minimal-armel$ sudo ./setup_sdcard.sh --probe-mmc
- [sudo] password for a4:
- Are you sure? I Don't see [/dev/idontknow], here is what I do see...
- fdisk -l:
- Disk /dev/sda: 3951 MB, 3951034368 bytes <---this one is SD card
- Disk /dev/sde: 146.8 GB, 146815733760 bytes
- mount:
- /dev/sde1 on / type ext4 (rw,errors=remount-ro,commit=0)
- devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
- /dev/sde6 on /home type ext4 (rw,commit=0)
- /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:
- 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網絡是否通暢。
- for Ethernet:
- ubuntu@omap:~$ sudo ifconfig -a
- ubuntu@omap:~$ sudo apt-get update
- No return, nothing installed, cann't find source.
- sudo apt-get install gdm xubuntu-desktop
提示:
- Need to get 41.5 MB/429 MB of archives.
- 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個,系統提示:
- ...
- Failed to fetch http://ports.ubuntu.com/ubuntu-ports/pool/main/u/update-manager_0.152.25.5_all.deb 404 Not Found
- E:Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
- ubuntu@omap:~$
按照提示繼續安裝
- ubuntu@omap:~$ sudo apt-get update
- [sudo] password for Ubuntu:
- Ign http://ports.ubuntu.com/ oneiric InRelease
- ...
- Fetched 618 KB in 15s (40.7 KB/s)
- Reading package lists... Done
- ubuntu@omap:~$
再次運行
- sudo apt-get install gdm xubuntu-desktop
安裝重新開始,中間有一步需要爲圖形界面方式來選擇安裝的桌面系統。
xm先下載所有的包文件,然後在執行編譯和安裝,這種在目標機上直接編譯安裝的方式,優點是解決了Ubuntu交叉編譯非常困難的問題,不足是編譯時間長達數十個小時,尚且還不能用鏡像文件的方式複製系統文件。
最後,編譯完成
- ...
- update-initramfs: Generating /boot/initd.img-3.2.3-x4
- ubuntu@omap:~$ sudo shutdown -r now
重新啓動後,系統進入圖形登錄界面,同樣使用用戶名爲ubuntu,密碼爲temppwd登錄。進入基於xbuntu的XFCE4.8桌面系統。默認顯示器分辨率爲1280x720,本次實驗修改了該參數,修改方法爲:把SD插入到PC中,打開uEnv.txt文件,修改1280x720MR-16@60爲dvimode=1280x800MR-16@60。
- bootfile=uImage
- bootinitrd=uInitrd
- address_uimage=0x80300000
- address_uinitrd=0x81600000
- vram=12MB
- console=ttyO2,115200n8
- defaultdisplay=dvi
- dvimode=1280x800MR-16@60
- mmcroot=/dev/mmcblk0p2 ro
- mmcrootfstype=ext4 rootwait fixrtc
- optargs=console=tty0
- mmc_load_uimage=fatload mmc 0:1 ${address_uimage} ${bootfile}
- mmc_load_uinitrd=fatload mmc 0:1 ${address_uinitrd} ${bootinitrd}
- 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}
- 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
- Are you 100% sure, on selecting [/dev/sda] (y/n)? y
- Downloading Device's Bootloader
- -----------------------------
- rcn-ee.net down, using mirror
- -----------------------------
- 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]
- 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]
- SPL Bootloader: MLO-beagleboard-v2011.12-r1
- 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]
- UBOOT Bootloader: u-boot-beagleboard-v2011.12-r1.img
- Unmounting Partitions
- -----------------------------
- Using fdisk to create BOOT Partition
- -----------------------------
- WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
- switch off the mode (with command 'c').
- WARNING: cylinders as display units are deprecated. Use command 'u' to
- change units to sectors.
- Command (m for help): Command action
- e extended
- p primary partition (1-4)
- Partition number (1-4, default 1): First cylinder (1-1020, default 1): Last cylinder, +cylinders or +size{K,M,G} (1-1020, default 1020):
- Command (m for help): Selected partition 1
- Hex code (type L to list codes): Changed system type of partition 1 to e (W95 FAT16 (LBA))
- Command (m for help):
- Disk /dev/sda: 3951 MB, 3951034368 bytes
- 122 heads, 62 sectors/track, 1020 cylinders
- Units = cylinders of 7564 * 512 = 3872768 bytes
- Sector size (logical/physical): 512 bytes / 512 bytes
- I/O size (minimum/optimal): 512 bytes / 512 bytes
- Disk identifier: 0x000a824e
- Device Boot Start End Blocks Id System
- /dev/sda1 1 18 68045 e W95 FAT16 (LBA)
- Command (m for help): The partition table has been altered!
- Calling ioctl() to re-read partition table.
- WARNING: If you have created or modified any DOS 6.x
- partitions, please see the fdisk manual page for additional
- information.
- Syncing disks.
- Setting Boot Partition's Boot Flag
- -----------------------------
- Creating rootfs ext4 Partition
- -----------------------------
- Formating Boot Partition
- -----------------------------
- mkfs.vfat 3.0.9 (31 Jan 2010)
- Formating rootfs Partition as ext4
- -----------------------------
- mke2fs 1.41.14 (22-Dec-2010)
- Filesystem label=rootfs
- OS type: Linux
- Block size=4096 (log=2)
- Fragment size=4096 (log=2)
- Stride=0 blocks, Stripe width=0 blocks
- 237104 inodes, 947391 blocks
- 47369 blocks (5.00%) reserved for the super user
- First data block=0
- Maximum filesystem blocks=973078528
- 29 block groups
- 32768 blocks per group, 32768 fragments per group
- 8176 inodes per group
- Superblock backups stored on blocks:
- 32768, 98304, 163840, 229376, 294912, 819200, 884736
- Writing inode tables: done
- Creating journal (16384 blocks): done
- Writing superblocks and filesystem accounting information: done
- This filesystem will be automatically checked every 24 mounts or
- 180 days, whichever comes first. Use tune2fs -c or -i to override.
- Populating Boot Partition
- -----------------------------
- `/tmp/tmp.YjmRll9n0E/dl/MLO-beagleboard-v2011.12-r1' -> `/tmp/tmp.YjmRll9n0E/disk/MLO'
- `/tmp/tmp.YjmRll9n0E/dl/u-boot-beagleboard-v2011.12-r1.img' -> `/tmp/tmp.YjmRll9n0E/disk/u-boot.img'
- Using mkimage to create uImage
- -----------------------------
- Image Name: 3.2.3-x4
- Created: Fri Feb 24 09:26:28 2012
- Image Type: ARM Linux Kernel Image (uncompressed)
- Data Size: 3014464 Bytes = 2943.81 kB = 2.87 MB
- Load Address: 80008000
- Entry Point: 80008000
- Using mkimage to create uInitrd
- -----------------------------
- Image Name: initramfs
- Created: Fri Feb 24 09:26:30 2012
- Image Type: ARM Linux RAMDisk Image (uncompressed)
- Data Size: 3087289 Bytes = 3014.93 kB = 2.94 MB
- Load Address: 00000000
- Entry Point: 00000000
- Copying uEnv.txt based boot scripts to Boot Partition
- -----------------------------
- `/tmp/tmp.YjmRll9n0E/bootscripts/normal.cmd' -> `/tmp/tmp.YjmRll9n0E/disk/uEnv.txt'
- bootfile=uImage
- bootinitrd=uInitrd
- address_uimage=0x80300000
- address_uinitrd=0x81600000
- vram=12MB
- console=ttyO2,115200n8
- defaultdisplay=dvi
- dvimode=1280x720MR-16@60
- mmcroot=/dev/mmcblk0p2 ro
- mmcrootfstype=ext4 rootwait fixrtc
- optargs=console=tty0
- mmc_load_uimage=fatload mmc 0:1 ${address_uimage} ${bootfile}
- mmc_load_uinitrd=fatload mmc 0:1 ${address_uinitrd} ${bootinitrd}
- 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}
- loaduimage=run mmc_load_uimage; run mmc_load_uinitrd; echo Booting from mmc ...; run mmcargs; bootm ${address_uimage} ${address_uinitrd}
- -----------------------------
- `/tmp/tmp.YjmRll9n0E/readme.txt' -> `/tmp/tmp.YjmRll9n0E/disk/tools/readme.txt'
- `/tmp/tmp.YjmRll9n0E/update_boot_files.sh' -> `/tmp/tmp.YjmRll9n0E/disk/tools/update_boot_files.sh'
- `/tmp/tmp.YjmRll9n0E/minimal_xfce.sh' -> `/tmp/tmp.YjmRll9n0E/disk/tools/minimal_xfce.sh'
- `/tmp/tmp.YjmRll9n0E/get_chrome.sh' -> `/tmp/tmp.YjmRll9n0E/disk/tools/get_chrome.sh'
- Finished populating Boot Partition
- -----------------------------
- Populating rootfs Partition
- Please be patient, this may take a few minutes, as its transfering a lot of files..
- -----------------------------
- 383MB 0:06:22 [ 1MB/s] [==================================>] 100%
- Transfer of Base Rootfs Complete, syncing to disk
- -----------------------------
- Ubuntu: with no eth cable connected it can take up to 2 mins to login, removing upstart sleep call
- -----------------------------
- Ubuntu: to unfix: sudo sed -i -e 's:#sleep 40:sleep 40:g' /etc/init/failsafe.conf
- Ubuntu: to unfix: sudo sed -i -e 's:#sleep 59:sleep 59:g' /etc/init/failsafe.conf
- -----------------------------
- Finished populating rootfs Partition
- -----------------------------
- setup_sdcard.sh script complete
- a4@a4-390:~/beagleXmUbuntu11.10/ubuntu-11.10-r5-minimal-armel$