Build your own image on W2

How to make a SD card with bootloader

After power on, there are 3 steps must be done before loading kernel,(Normally they all are called bootloader):

step 1: CPU init - the code is inside CPU;

step 2: init the flash device on which we boot from; (normally it’s called preloader)

step 3: u-boot;

RTD1296 supports booting from eMMC and SPI flash, so if we want to boot W2 from SD card, (that means we put u-boot on the SD card.) the second step code must be written to SPI flash, normally it’s done in factory before the board sending out, and the code is fixed and provided by RTK without source. We need not care about it, it does a simple job.

In fact, if the board will boot from eMMC, the second code must be written to eMMC first too, remember that we introduced how to do it with u-boot together on other pages. Normally it’s also been done in factory.

The u-boot for eMMC and SD card are different, normally eMMC u-boot 's name is dvrboot.exe.bin, and u-boot for SD card name is u-boot.bin.

Banana Pi W2 board can boot from EMMC flash or SPI flash on the board, the difference is the location of the bootloader, so if you will not participate in the development of u-boot, this will not matter to you. So here is how to write bootloader to EMMC.

Normally the W2 board you got had been programed in the factory, but if the version of the bootloader isn’t the latest one, I recommend you to program it by yourself again. The latest version of bootloader is available on the Banana Pi website.

1.Using fdisk tool to create two partitions in SD card: format the first partition as FAT32, and the second partition as ext4; It’s recommended that the first partition size should not be less than 100M;

2.Copy the three files: bpi-w2.dtb, uImage, bluecore.audio to the first partition;

3.Copy the all files in root filesystem which just built by us to the second partition using root privilege:

cp -a rootfs/* /media/xxx/sdxx/
sync

4.Eject the SD card and insert it to the W2 board, after power on the board, you can see the ubuntu is running now.

5.Set up network and get packages by using apt-get from ubuntu repository