移植ubuntu core到Arm开发板

前端之家收集整理的这篇文章主要介绍了移植ubuntu core到Arm开发板前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
origin: http://blog.csdn.net/kickxxx/article/details/15341079

最初是想把整个ubuntu移植到MX51开发板,因为项目不需要运行桌面系统,所以只移植了一个基本的ubuntu core系统

1. 下载ubuntu core rootfs,关于ubuntu core参考https://wiki.ubuntu.com/Core

http://cdimage.ubuntu.com/ubuntu-core/releases/12.04/release/ubuntu-core-12.04.3-core-armhf.tar.gz

这个镜像就是一个rootfs,可以作为根文件系统使用。


2. 把镜像烧写到开发板的一个分区上

  • adb shell进入开发板,busyBox mkfs.ext2 /dev/block/mmcblk0p1
  • adb shell进入开发板,mount -t ext2 /dev/block/mmcblk0p1 /mnt
  • adb push ubuntu-core-12.04.3-core-armhf.tar.gz /mnt/
  • adb shell进入开发板,cd /mnt; busyBox tar ubuntu-core-12.04.3-core-armhf.tar.gz. 在/dev/block/mmcblk0p1这个分区上建立了一个完整的rootfs,文件系统类型为ext2


3. 我的arm开发板是mx51,修改uboot启动参数如下:

set bootargs_android 'setenv bootargs ${bootargs_base} init=/init rdinit=asdf root=b301 rootfs=ext2 di0_primary video=mxcdi0fb:RGB24,CLAA-WVGA'

粗体是我增加的参数,解释下增加的几个参数:

  • rdinit=asdf,rdinit=后的asdf是胡乱写的,这样会设置ramdisk_execute_command为asdf,就导致内核代码
      @H_301_57@if(sys_access((constchar__user*)ramdisk_execute_command,0)!=0){
    sys_access访问失败,调用prepare_namespace 从mmcblk0p1安装根文件系统
  • root=b301,是/dev/block/mmcblk0p1的16进制主设备号b3和从设备号01
  • rootfs=ext2,文件系统类型

4. 启动开发板,会打印出如下信息:

    @H_301_57@VFS:Mountedroot(ext2filesystem)ondevice179:1.

表示已经mount 根文件系统成功。

这一步可能会出现如下错误

    @H_301_57@udevd[123]:unabletoreceivectrlconnection:Functionnotimplemented
  1. udevd[123]:unabletoreceivectrlconnection:Functionnotimplemented
  2. @H_301_57@udevd[123]:unabletoreceivectrlconnection:Functionnotimplemented
  3. udevd[123]:unabletoreceivectrlconnection:Functionnotimplemented
  4. @H_301_57@udevd[123]:unabletoreceivectrlconnection:Functionnotimplemented
  5. udevd[123]:unabletoreceivectrlconnection:Functionnotimplemented
如果你出现了,那么执行第5步


5. 按链接给的patch,修改内核

https://github.com/genesi/Linux-legacy/commit/a84fac75f38de592e530a2f9f982d7aafec6c288


6. 编译内核并烧写到开发板上,重启系统后,不会再打印step4的错误


7. 支持LCD console,修改内核配置文件如下

    @H_301_57@@@-1228,8+1228,14@@CONFIG_FB_MXC_SYNC_PANEL=y
  1. #Consoledisplaydriversupport
  2. @H_301_57@#
  3. #CONFIG_VGA_CONSOLEisnotset
  4. @H_301_57@+#CONFIG_VGACON_SOFT_SCROLLBACKisnotset
  5. CONFIG_DUMMY_CONSOLE=y
  6. @H_301_57@-#CONFIG_FRAMEBUFFER_CONSOLEisnotset
  7. +CONFIG_FRAMEBUFFER_CONSOLE=y
  8. @H_301_57@+#CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARYisnotset
  9. +#CONFIG_FRAMEBUFFER_CONSOLE_ROTATIONisnotset
  10. @H_301_57@+#CONFIG_FONTSisnotset
  11. +CONFIG_FONT_8x8=y
  12. @H_301_57@+CONFIG_FONT_8x16=y

重新编译内核,重启系统后,可在LCD看到ubuntu的登录console


8 支持serial console,我的开发板没有usbhost,不能接usb键盘,所以需要用serial console控制

  • 在/etc/init.d增加文件/etc/init/ttymxc.conf
    1. @H_301_57@#console-getty
    2. #
    3. @H_301_57@#Thisservicemaintainsagettyonconsolefromthepointthesystemis
    4. #starteduntilitisshutdownagain.
    5. @H_301_57@
    6. startonstoppedrcRUNLEVEL=[2345]andcontainerCONTAINER=lxc
    7. @H_301_57@
    8. stoponrunlevel[!2345]
    9. @H_301_57@
    10. respawn
    11. @H_301_57@exec/sbin/getty-L115200ttymxc0vt102

  • 修改rootfs的文件/etc/rc.local,如下
    1. @H_301_57@#!/bin/sh-e
    2. #
    3. @H_301_57@#rc.local
    4. #
    5. @H_301_57@#Thisscriptisexecutedattheendofeachmultiuserrunlevel.
    6. #Makesurethatthescriptwill"exit0"onsuccessoranyother
    7. @H_301_57@#valueonerror.
    8. #
    9. @H_301_57@#Inordertoenableordisablethisscriptjustchangetheexecution
    10. #bits.
    11. @H_301_57@#
    12. #Bydefaultthisscriptdoesnothing.
    13. @H_301_57@startttymxc0
    14. exit0

重新启动后,即可在串口得到控制台信息。

猜你在找的Ubuntu相关文章