Chinaunix首页 | 论坛 | 博客
  • 博客访问: 659068
  • 博文数量: 186
  • 博客积分: 1875
  • 博客等级: 上尉
  • 技术积分: 2117
  • 用 户 组: 普通用户
  • 注册时间: 2010-10-23 23:21
个人简介

有时候,就是想窥视一下不知道的东东,因为好奇!

文章分类

全部博文(186)

文章存档

2024年(2)

2023年(3)

2020年(1)

2019年(1)

2018年(1)

2017年(2)

2016年(69)

2015年(53)

2014年(14)

2013年(1)

2012年(5)

2011年(25)

2010年(9)

分类: 嵌入式

2015-01-17 11:56:03

一. ubuntu-14.04環境下工具链
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install build-essential u-boot-tools binutils-arm-linux-gnueabihf gcc-4.7-arm-linux-gnueabihf-base g++-4.7-arm-linux-gnueabihf 
gcc-arm-linux-gnueabihf cpp-arm-linux-gnueabihf libusb-1.0-0 libusb-1.0-0-dev git wget fakeroot kernel-package zlib1g-dev libncurses5-dev

二. 获取BSP资料库
$ git clone
  以上命令完成后会在当前目录下生成bananapro-bsp目录,里面有一堆相关文件
三. 编译生成需要的文件
进入bananapro-bsp目录
$  cd bananapro-bsp/

$ ./configure BananaPi
  输出如下:

点击(此处)折叠或打开

  1. zl@zl-VirtualBox:/opt/bananapi/bananapro-bsp$ ./configure BananaPi
  2. Submodule 'allwinner-tools' () registered for path 'allwinner-tools'
  3. Submodule 'cedarx-libs' () registered for path 'cedarx-libs'
  4. Submodule 'linux-sunxi' () registered for path 'linux-sunxi'
  5. Submodule 'sunxi-boards' () registered for path 'sunxi-boards'
  6. Submodule 'sunxi-tools' () registered for path 'sunxi-tools'
  7. Submodule 'u-boot-sunxi' () registered for path 'u-boot-sunxi'
  8. Cloning into 'sunxi-boards'...
  9. remote: Counting objects: 1340, done.
  10. remote: Compressing objects: 100% (488/488), done.
  11. remote: Total 1340 (delta 840), reused 1340 (delta 840)
  12. Receiving objects: 100% (1340/1340), 432.85 KiB | 43.00 KiB/s, done.
  13. Resolving deltas: 100% (840/840), done.
  14. Checking connectivity... done.
  15. Submodule path 'sunxi-boards': checked out '843d202665a520217b9c021b3914cd64c7fc32ce'
  16. BananaPi configured. Now run `make`
  17. zl@zl-VirtualBox:/opt/bananapi/bananapro-bsp$
$ make    //這個過程很長
  完成后生成的文件中包括以下文件
  ./sunxi-boards/sys_config/a20/BananaPi.fex
  ./sunxi-tools/fex2bin
1. 创建script.bin
   $ ./sunxi-tools/fex2bin sunxi-boards/sys_config/a20/BananaPi.fex script.bin
2. 创建u-boot
   $ make -C ./u-boot-sunxi/ CROSS_COMPILE=arm-linux-gnueabihf- BananaPi_config
   $ make -C ./u-boot-sunxi/ CROSS_COMPILE=arm-linux-gnueabihf-
    生成的文件中包括 ./u-boot-sunxi/u-boot-sunxi-with-spl.bin
3. 创建kernel
   设置内核配置
  $ make -C linux-sunxi/ ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- sun7i_defconfig
  调整内核配置
  $ make -C linux-sunxi/ ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig
   生成内核和模块文件
   make -C linux-sunxi/ ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- uImage modules
  建立完整的模块树
 $ make -C linux-sunxi/ ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=output modules_install
  生成的文件中包括
  linux-sunxi/arch/arm/boot/uImage
  linux-sunxi/output/lib/modules/3.4.103/

四. 准备文件系统
    用现成的ubuntu的吧
   下载地址
       http://cdimage.ubuntu.com/ubuntu-core/releases/14.04/release/ubuntu-core-14.04-core-armhf.tar.gz
    至此需要的文件都已得到.
   u-boot-sunxi-with-spl.bin
     script.bin
     uImage

     modules/3.4.103
     ubuntu-core-14.04-core-armhf.tar.gz

五. 安装
    将准备好的SD卡插入到机器的USB口
     1、烧写u-boot
     $ sudo dd if=/dev/zero of=/dev/sdb bs=1M count=1
     $ sudo dd if=u-boot-sunxi-with-spl.bin of=/dev/sdb bs=1024 seek=8
    2. 
新建两个主分区

点击(此处)折叠或打开

  1. hr@huarain:/opt/study/bananaPI/bananapi-ubuntu/release/r1$ sudo fdisk /dev/sdb
  2. Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
  3. Building a new DOS disklabel with disk identifier 0x688b16d8.
  4. Changes will remain in memory only, until you decide to write them.
  5. After that, of course, the previous content won't be recoverable.
  6. Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
  7. 命令(输入 m 获取帮助): n
  8. Partition type:
  9. p primary (0 primary, 0 extended, 4 free)
  10. e extended
  11. Select (default p): p
  12. 分区号 (1-4,默认为 1):
  13. 将使用默认值 1
  14. 起始 sector (2048-30898175,默认为 2048):
  15. 将使用默认值 2048
  16. Last sector, +扇区 or +size{K,M,G} (2048-30898175,默认为 30898175): +20M
  17. 命令(输入 m 获取帮助): n
  18. Partition type:
  19. p primary (1 primary, 0 extended, 3 free)
  20. e extended
  21. Select (default p):
  22. Using default response p
  23. 分区号 (1-4,默认为 2):
  24. 将使用默认值 2
  25. 起始 sector (43008-30898175,默认为 43008):
  26. 将使用默认值 43008
  27. Last sector, +扇区 or +size{K,M,G} (43008-30898175,默认为 30898175):
  28. 将使用默认值 30898175
  29. 命令(输入 m 获取帮助): w
  30. The partition table has been altered!
  31. Calling ioctl() to re-read partition table.
  32. Syncing disks.
  33. hr@huarain:/opt/study/bananaPI/bananapi-ubuntu/release/r1$

3、SD卡数据准备

    $ sudo mkfs.vfat /dev/sdb1
          $ sudo mkfs.ext2 /dev/sdb2

4、复制script.bin和uImage文件
        $ sudo mount /dev/sdb1 /mnt
        $ sudo cp script.bin /mnt
        $ sudo cp uImage /mnt/
        $ sudo umount /mnt


 5. 解压ubuntu文件系统
        $ sudo mount /dev/sdb2 /mnt
        $ sudo tar -xf ubuntu-core-14.04.1-core-armhf.tar.gz -C /mnt/
       6. 清空用户密码: 将新建解压的文件系统中的/mnt/etc/passwd中的第一行"root:x: ..."中的对应密码的这"x"删除掉
           (如果不这样, 还有其它的登录系统方法吗?)
           sudo vi /mnt/etc/passwd 
       7. 将前面得到的的modules/3.4.103/复制到/mnt/lib/目录下
             cp -r modules/3.4.103 /mnt/lib/

   $ sudo umount /mnt

  8. 将SD卡插入BananaPi上面,上电,等待着系统启动起来,用户名和密码呢?是BananaPi呢?还是bananapi呢?

  用户名:root
        密码:(空)
   



阅读(2825) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~