一. 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
输出如下:
-
zl@zl-VirtualBox:/opt/bananapi/bananapro-bsp$ ./configure BananaPi
-
Submodule 'allwinner-tools' () registered for path 'allwinner-tools'
-
Submodule 'cedarx-libs' () registered for path 'cedarx-libs'
-
Submodule 'linux-sunxi' () registered for path 'linux-sunxi'
-
Submodule 'sunxi-boards' () registered for path 'sunxi-boards'
-
Submodule 'sunxi-tools' () registered for path 'sunxi-tools'
-
Submodule 'u-boot-sunxi' () registered for path 'u-boot-sunxi'
-
Cloning into 'sunxi-boards'...
-
remote: Counting objects: 1340, done.
-
remote: Compressing objects: 100% (488/488), done.
-
remote: Total 1340 (delta 840), reused 1340 (delta 840)
-
Receiving objects: 100% (1340/1340), 432.85 KiB | 43.00 KiB/s, done.
-
Resolving deltas: 100% (840/840), done.
-
Checking connectivity... done.
-
Submodule path 'sunxi-boards': checked out '843d202665a520217b9c021b3914cd64c7fc32ce'
-
BananaPi configured. Now run `make`
-
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. 新建两个主分区
-
hr@huarain:/opt/study/bananaPI/bananapi-ubuntu/release/r1$ sudo fdisk /dev/sdb
-
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
-
Building a new DOS disklabel with disk identifier 0x688b16d8.
-
Changes will remain in memory only, until you decide to write them.
-
After that, of course, the previous content won't be recoverable.
-
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
-
命令(输入 m 获取帮助): n
-
Partition type:
-
p primary (0 primary, 0 extended, 4 free)
-
e extended
-
Select (default p): p
-
分区号 (1-4,默认为 1):
-
将使用默认值 1
-
起始 sector (2048-30898175,默认为 2048):
-
将使用默认值 2048
-
Last sector, +扇区 or +size{K,M,G} (2048-30898175,默认为 30898175): +20M
-
命令(输入 m 获取帮助): n
-
Partition type:
-
p primary (1 primary, 0 extended, 3 free)
-
e extended
-
Select (default p):
-
Using default response p
-
分区号 (1-4,默认为 2):
-
将使用默认值 2
-
起始 sector (43008-30898175,默认为 43008):
-
将使用默认值 43008
-
Last sector, +扇区 or +size{K,M,G} (43008-30898175,默认为 30898175):
-
将使用默认值 30898175
-
命令(输入 m 获取帮助): w
-
The partition table has been altered!
-
Calling ioctl() to re-read partition table.
-
Syncing disks.
-
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
密码:(空)
阅读(2870) | 评论(0) | 转发(0) |