Difference between revisions of "IoTGateway/BSP/Linux/APQ8016/BSP User Guide V1"

From ESS-WIKI
Jump to: navigation, search
Line 213: Line 213:
 
Now, you have both boot & rootfs images. You can easily flash them into eMMC via fastboot utility.
 
Now, you have both boot & rootfs images. You can easily flash them into eMMC via fastboot utility.
  
  $ fastboot erase boot
+
  $ sudo fastboot erase boot
  $ fastboot flash boot boot-MACHINE-debian.img
+
  $ sudo fastboot flash boot boot-MACHINE-debian.img
  $ fastboot erase rootfs
+
  $ sudo fastboot erase rootfs
  $ fastboot flash rootfs linaro-stretch-alip-qcom-snapdragon-arm64-20170427-227-MACHINE.img
+
  $ sudo fastboot flash rootfs linaro-stretch-alip-qcom-snapdragon-arm64-20170427-227-MACHINE.img
  
 
'''Note:''' After booting up, you have an important thing to do! You have to generate modules.dep and map files.
 
'''Note:''' After booting up, you have an important thing to do! You have to generate modules.dep and map files.

Revision as of 09:05, 20 June 2017

Getting Started

Conventions

${MACHINE} : available target boards list below

rsb-4760 / epc-r4761

${DISTRO} : Linux distribution

rpb / rpb-wayland

${RPB-IMAGES} : meta-rpb provides the following images

rpb-console-image / rpb-desktop-image / rpb-minimal-image / rpb-qt5-image / rpb-weston-image

Build Environment on Host

Currently, we adopt Docker as build environment.

You can get the latest version of advrisc/u14.04-410clbv1 Docker image for developing Qualcomm APQ8016 projects.

If you don't know much about Docker, please refer to IoTGateway/Docker for details.

BSP

BSP Source

You have two methods to put BSP into Docker container.

Download BSP from GitHub

The oe-rpb-manifest @GitHub is our manifest repository for Qualcomm APQ8016 projects. You can use repo init & repo sync to get the entire BSP we put on GitHub.

Checking the steps in oe-rpb-manifest to get a specific version of BSP or a latest one.

Copy BSP tarball into Container

Downloads Folder

Naming Rule

BSP Content

Build Instructions

Create New Build Environment

$ MACHINE=${MACHINE} DISTRO=${DISTRO} source setup-environment <Your build folder>

Load Existed Build Environment

$ source setup-environment <Your build folder>

Build Images

Ref: oe-rpb-manifest

Build Toolchain Installer

$ bitbake ${RPB-IMAGES} -c populate_sdk

Build Bootloader

Refer to Debian_16.09 " How to get and customize the bootloader "

$ git clone git://codeaurora.org/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8.git -b LA.BR.1.1.3.c4-01000-8x16.0
$ git clone http://git.linaro.org/landing-teams/working/qualcomm/lk.git -b debian-qcom-dragonboard410c-LA.BR.1.2.4-00310-8x16.0-linaro2
$ cd lk
$ make -j4 msm8916 EMMC_BOOT=1 TOOLCHAIN_PREFIX=<path to arm-eabi-4.8 tree>/bin/arm-eabi-

Build Linux Kernel

Ref: oe-rpb-manifest

Flash Pre-built Images

USB Download Tools

1. Install DragonBoardUpdateTool 32 bit, 64 bit

2. Switch USB Download Mode (SW1: 1,1), power on and then connect with USB Cable

3. Open Command Prompt on PC

> cd C:\Program Files\Qualcomm\DragonBoardUpdateTool

4. Check COM port

> emmcdl.exe -l

5. Flash

> emmcdl.exe -p [Your COM Port] -f mbns\8916\prog_emmc_firehose_8916_ddr.mbn -x rawprogram0.xml

if it is success, it will show

Status: 0 The operation completed successfully.

6. Flash

> emmcdl.exe -p [Your COM Port ] -f mbns\8916\prog_emmc_firehose_8916_ddr.mbn -x rawprogram2.xml

7. Finally, switch to SW1:(0,1), boot from EMMC or SD Card

Fastboot Tool

1. Check device id

$ sudo fastboot devices

2. Flash device

$ sudo ./flashall [Devices ID]

3. Erase boot / rootfs partitions

$ sudo fastboot erase boot
$ sudo fastboot erase rootfs

4. Flash images to boot /rootfs partitions

$ sudo fastboot flash boot <Your boot image>
$ sudo fastboot flash rootfs <Your boot image>

Installation SD Card

1. Boot from installation SD Card, and Click "Install"

Install_1

2. Flash all partitions

Install_2

3. Installing

Install_3

4. Finish and Reboot

Install_4

Customization

Set Up SDK

Create Debian Images

In this section, we will show you how to generate a Debian image based on the same Yocto kernel.

Customize the kernel source code

In Yocto BSP, you can build kernel easily. To learn how to build kernel, you can refer to oe-rpb-manifest.

Then, we need three output files in your build artifacts.

  • Kernel image (Image-MACHINE.bin)
  • DTS image (dt-Image-MACHINE.img)
  • Modules (modules-MACHINE.tgz)

Now you need to create a valid boot image with your own kernel build.

On your host PC, we need to install the following tools:

$ git clone git://codeaurora.org/quic/kernel/skales

To create the boot image, you also need a ramdisk image, and you can get one from the 96Boards release:

$ wget https://builds.96boards.org/snapshots/dragonboard410c/linaro/debian/227/initrd.img-4.9.21-linaro-lt-qcom

The tool mkbootimg is a standalone application that will process all files and create the boot image that can then be booted on the target board, or flash into the on-board eMMC. The boot image also contains the kernel bootargs, which can be changed as needed in the next command:

$ ./skales/mkbootimg --kernel Image-MACHINE.bin \
                   --ramdisk initrd.img-4.9.21-linaro-lt-qcom \
                   --output boot-MACHINE-debian.img \
                   --dt dt-Image-MACHINE.img \
                   --pagesize 2048 \
                   --base 0x80000000 \
                   --cmdline "root=/dev/disk/by-partlabel/rootfs rw rootwait console=ttyMSM0,115200n8"

After this step, you will get a boot image for Debian called boot-MACHINE-debian.img.

Revise Debian Rootfs

Basically, we can adopt Linaro's Debian rootfs directly with a little modifications for kernel modules. First, you can get the Debian rootfs from the 96Boards release:

$ wget https://builds.96boards.org/snapshots/dragonboard410c/linaro/debian/227/linaro-stretch-alip-qcom-snapdragon-arm64-20170427-227.img.gz

Second, unzip the file and transform it from sparse image to raw image.

$ gunzip linaro-stretch-alip-qcom-snapdragon-arm64-20170427-227.img.gz
$ simg2img linaro-stretch-alip-qcom-snapdragon-arm64-20170427-227.img rootfs.raw

Then, you are able to mount the raw rootfs, and update with your kernel modules.

$ sudo mount -o loop rootfs.raw /mnt
$ sudo rm -rf /mnt/lib/modules/

// Copy firmware & modules into /lib
$ tar zxf modules-MACHINE.tgz
$ sudo cp -a lib/* /mnt/lib
$ sudo umount /mnt

Finally, make the rootfs into sparse image.

$ ext2simg -v rootfs.raw linaro-stretch-alip-qcom-snapdragon-arm64-20170427-227-MACHINE.img

Flash Debian Images

Now, you have both boot & rootfs images. You can easily flash them into eMMC via fastboot utility.

$ sudo fastboot erase boot
$ sudo fastboot flash boot boot-MACHINE-debian.img
$ sudo fastboot erase rootfs
$ sudo fastboot flash rootfs linaro-stretch-alip-qcom-snapdragon-arm64-20170427-227-MACHINE.img

Note: After booting up, you have an important thing to do! You have to generate modules.dep and map files.

$ depmod -a

After reboot, the Debian system should work well!