• Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
HomepcDuinoA20 Based pcDuino3/3S/3C/3NanoBSP development for pcDuino3 (I): Port u-boot-2014 ...
Previous Next

BSP development for pcDuino3 (I): Port u-boot-2014-04

Posted by: admin , June 29, 2014

This is going to be a serial of tutorials covering BSP development work for pcDuino3.   In this post, we will discuss porting u-boot.

1. Setup a simple cross compilation environment

#sudo apt-get install g++-arm-linux-gnueabihf git

2. Download the source files of u-boot

#git clone https://github.com/linux-sunxi/u-boot-sunxi.git

3. Check if pcDuino3 is supported or not

 

#cd u-boot-sunxi

#grep sunxi boards.cfg | awk ‘{print $7}’

We can see that pcDuino3 is supported:

4. Create a new directory as working directory and configure u-boot

 

#mkdir build

#make CROSS_COMPILE=arm-linux-gnueabihf-  Linksprite_pcDuino3_config   O=build

<img class="alignnone" src="http://cnlearn.linksprite.com/wp-content/uploads/2014/06/52.png" alt="" width="1166" height="42" />

5. Build u-boot

 

#make CROSS_COMPILE=arm-linux-gnueabihf- O=build -j 8

<img class="alignnone" src="http://cnlearn.linksprite.com/wp-content/uploads/2014/06/22.png" alt="" width="1348" height="383" />

We can check the output files:

Here we need is u-boot-sunxi-with-spl.

6. As the boot0 and boot1 that can boot from NAND is NOT open source. We will only show how to make them booting from SD. It is also proper for eMMC.

 

First we do the following partitions on a SD card that is mounted to the host PC.

# fdisk /dev/mmcblk0
 
Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-15523839, default 2048): 2048
Last sector, +sectors or +size{K,M,G} (2048-15523839, default 15523839): +15M 
 
Command (m for help): n
Partition type:
   p   primary (1 primary, 0 extended, 3 free)
   e   extended
Select (default p): p    
Partition number (1-4, default 2): 2
First sector (32768-15523839, default 32768): 32768
Last sector, +sectors or +size{K,M,G} (32768-15523839, default 15523839): +240M
 
Command (m for help): p
 
Disk /dev/mmcblk0: 7948 MB, 7948206080 bytes
4 heads, 16 sectors/track, 242560 cylinders, total 15523840 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x17002d14
 
        Device Boot      Start         End      Blocks   Id  System
/dev/mmcblk0p1            2048       32767       15360   83  Linux
/dev/mmcblk0p2           32768      524287      245760   83  Linux
 
Command (m for help): w
The partition table has been altered!
 
Calling ioctl() to re-read partition table.


Then we write u-boot to SD:

#dd if=u-boot-with-spl.bin of=/dev/mmcblk0 bs=1024 seek=8

Now we format the first partition:

#mkfs.vfat /dev/mmcblk0p1

Mount:

# mount -t vfat /dev/mmcblkp1 /mnt

Create u-boot environment variables:

#cd /mnt

#vim uEnv.txt
fdt_high=ffffffff
loadkernel=fatload mmc 0 0x46000000 uImage
loaddtb=fatload mmc 0 0x49000000 dtb
bootargs=console=ttyS0,115200 earlyprintk root=/dev/mmcblk0p2 rootwait
uenvcmd=run loadkernel && run loaddtb && bootm 0x46000000 - 0x49000000
Insert the SD to the pcDuino and power it up. We will get the following message:

 

Tags: A20 Based pcDuino3/3S/3C/3Nano

Share!
Tweet

admin

About the author

Leave a Reply Cancel reply

You must be logged in to post a comment.

Category

  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors