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$