Skip to content

DragonBoard 820c Getting Started With Linux

Nicolas Dechesne edited this page Dec 1, 2017 · 27 revisions

This page has instructions to get started with Debian or OpenEmbedded on the DragonBoard 820c board.

Disclaimer

DragonBoard 820c is not yet commercially available and is in beta testing only. Please expect limited documentation and support until further notice.

Software releases will be eventually available on 96boards.org, for now all builds are installed from 96boards.org 'snapshots' area which is updated regularly.

Bootloaders

The DB820c might come with bootloaders pre-loaded, however it is recommended to install the default bootloaders available on 96boards.org. The DB820c can be rescued using the bootloader package from http://builds.96boards.org/snapshots/dragonboard820c/linaro/rescue/latest/. Each build includes the following files:

  • dragonboard-820c-sdcard-rescue-xx.zip it is an SD card image that can be used to rescue the DB820c. You would flash the image on your PC, and use it to boot the DB820c from SD. The rescue image will boot into fastboot mode, which would allow the user to install all relevant bootloaders into the the onboard storage (an UFS disk).
  • dragonboard-820c-bootloader-ufs-linux-xx.zip it includes all needed bootloaders that can be flashed into the UFS onboard storage

The bootloaders can be flashed onto the Dragonboard 820c using two different methods:

  1. Using the SD rescue image
  2. Using USB flashing tools

Both methods are described in this wiki.

The bootloader packages released on 96boards are based on the Linux firmware board support package released by Qualcomm on QDN website.

Onboard storage

This board has a 32GB UFS drive and the drive is physically partitioned like this:

Disk /dev/sda: 6335488 sectors, 24.2 GiB
Disk /dev/sdb: 1024 sectors, 4.0 MiB
Disk /dev/sdc: 1024 sectors, 4.0 MiB
Disk /dev/sdd: 32768 sectors, 128.0 MiB
Disk /dev/sde: 1048576 sectors, 4.0 GiB
Disk /dev/sdf: 393216 sectors, 1.5 GiB

For now there is no partitioning tool which is provided, so it is not recommended to change the partition layout. The root file system can be installed in userdata or system based on how much space is needed. It is even possible to install a Debian image in userdata and an OpenEmbedded image in system partition.

The main useful partitions for now are :

  • /dev/sda9 is userdata and is ~24GB
  • /dev/sde18 is system and is ~3GB
  • /dev/sde17 is boot

Flashing the device with an SD rescue card

This method only works if your board is at least rev P2

Create the SD rescue card

As mentioned above, SD rescue images are published with on 96boards.org, download all files from: http://builds.96boards.org/snapshots/dragonboard820c/linaro/rescue/latest/

Then, extract the SD card image from the file dragonboard-820c-sdcard-rescue-xx.zip and on your PC, you can write the image file to a micro SD card:

dd if=dragonboard-820c-sdcard-rescue-20.img of=/dev/<your micro SD card> bs=4M oflag=sync status=noxfer

Connecting the DB820c

  • In order to force the DB820c to boot from SD you need to configure S1 switch properly. S1 is on the back of the board underneath the micro SD slot. Set S1 to OFF,ON,ON,OFF
  • Connect a USB cable from the micro USB to your PC.
  • Connect UART console
  • Connect the power whilst holding S4 (Vol-Minus)

Boot from SD card into fasboot mode

If all the steps above were done properly you should see some debug traces on the console, and at the end something like:

fastboot: processing commands

which means that the board has entered in fastboot mode properly.

Flashing the bootloader in onboard UFS drive

When booting with the SD rescue image, the fastboot flash command will in turn write into the onboard UFS. So it can be used to (re)partition the UFS, and/or flash any partition.

From the files downloaded earlier, extract the content of dragonboard-820c-bootloader-ufs-linux-xx.zip and then you can reflash the entire UFS using the provided script:

./flashall

If everything works fine, you should be all set now. And you can proceed further with this wiki to install Debian or OpenEmbedded images released on 96boards.

Flashing with USB

Alternatively, the Dragonboard 820c can also be recovered/flashed using USB. An open source tool that implements the Qualcomm Sahara protocol has been developed by Linaro. When booting from USB the internal SoC ROM code (also called PBL) implements the Sahara protocol to communicate with a PC host. After an initial setup phase, the Sahara protocol can be used to download a flashing programmer into the SoC internal memory, which implements the Firehose protocol. This protocol allows the host PC to send commands to write into the onboard storage (eMMC or UFS). The programmer file is included in the QDN Linux board support release from Qualcomm.

Get the Linux flashing tool

git clone https://git.linaro.org/landing-teams/working/qualcomm/qdl.git

This is provided in source code, and it needs to be compiled locally. It uses libxml, so on Ubuntu/Debian you will need:

sudo apt-get install libxml2-dev

To compile qdl project, it should be as simple as running make command in the root of the project.

Connecting the DB820c

  • In order to force the DB820c to boot on USB, you need to configure S1 switch properly. S1 is on the back of the board underneath the micro SD slot.
  • If you have a P2 board (or above, which is the most likely situation), set it to ON,OFF,OFF,ON. Otherwise if you have a P1 board, set it to ON,ON,OFF,ON
  • Connect a USB cable from the micro USB to your PC.
  • Connect UART console

Flashing the device

Download and unzip the most recent bootloader package:

http://builds.96boards.org/snapshots/dragonboard820c/linaro/rescue/latest/dragonboard-820c-bootloader-ufs-linux-*.zip

Then run:

cd dragonboard-820c-bootloader-ufs-linux-*/
sudo <PATH to qdl>/qdl prog_ufs_firehose_8996_ddr.elf rawprogram.xml patch.xml

It should take a few seconds. And you should eventually get something like that:

...
...
Update Backup Header with CRC of Backup Header.
LOG: crc start sector 393215, over bytes 92
LOG: Patched sector 393215 with 8FDB38DF
LUN1 is now bootable device
LOG: Inside handlePower() - Requested POWER_RESET
LOG: Issuing bsp_target_reset() after 1 seconds, if this hangs, do you have WATCHDOG enabled?

Booting into fastboot

If the flashing process succeeded, all the right bootloaders and partition table should have been set. And fastboot can now be used to flash Linux root file system. The first thing to try is to get into fastboot, to make sure the flashing completed properly.

  • Power off the board
  • Set Switch S1 to OFF,OFF,OFF,OFF.
  • Connect the debug UART / serial console to your Linux PC, if not done already
  • Connect the micro USB cable (J4) to your Linux PC.
  • Open UART/serial console
  • Power on the device

You should some see debug traces on the console, and at the end something like:

S- QC_IMAGE_VERSION_STRING=BOOT.XF.1.0-00301
...
...
fastboot: processing commands

Some board might have a valid boot partition pre-flashed, in which case the bootloader will load it and boot it. So if you see a Linux kernel being booted before flashing it yourself, then power cycle the board and press the Vol (-) key , so that it will force the bootloader to stop in fastboot mode. And normally you should now see the following in the UART console:

fastboot: processing commands

And you can now erase the boot partition, so that you don't need to press Vol (-) when powering it, on your PC, run:

fastboot erase boot

If the board boots into the OS by default and you do not have any way to interrupt in between, then once you get a root prompt after booting into the OS, use the following command to erase the boot partition:

cat /dev/zero > /dev/disk/by-partlabel/boot

Installing Debian

Debian Buster images

As of build #108, the Linaro builds for Dragonboard 820c have been migrated to Debian Buster release. All images released on 96boards.org include firmware files for the hardware co processors such as GPU, WLAN, Venus or DSP.

Console (no graphics) image

Debian builds for the DB820c can be found here: http://builds.96boards.org/snapshots/dragonboard820c/linaro/debian/. They have for now has minimal features set (mostly console, UFS, 4 core running at the lowest speed). Features will be added in this builds stream.

To install the Debian root file system:

  1. Download either the `developer`` image from the link above
  2. Uncompress the root file system image
  3. Flash the image into userdata (or system).

So, assuming you are trying to use the latest build:

wget http://builds.96boards.org/snapshots/dragonboard820c/linaro/debian/latest/linaro-buster-developer-dragonboard-820c-*.img.gz
gunzip linaro-buster-developer-dragonboard-820c-*.img.gz
fastboot flash userdata linaro-buster-developer-dragonboard-820c-*.img

You can also mount the rootfs image on an NFS partition; to do that and since the image above is an sparse image you will have to first unsparse it and then mount it.

simg2img linaro-buster-developer-dragonboard-820c-*.img rootfs.img
mount -t nfs rootfs.img mnt/

You can download the prebuilt boot image as well, from the same location.

wget http://builds.96boards.org/snapshots/dragonboard820c/linaro/debian/latest/boot-linaro-buster-dragonboard-820c-*.img.gz
gunzip boot-linaro-buster-dragonboard-820c-*.img.gz
fastboot flash boot boot-linaro-buster-dragonboard-820c-*.img

To update the kernel command line embedded in the .img to support an NFS mounted root partition the command could be as follows (for an nfs server in 192.168.1.4)

    abootimg -u boot-linaro-buster-dragonboard-820c-*.img -c "cmdline=root=/dev/nfs rw nfsroot=192.168.1.4:/Exports/qcom/rootfs,v3,tcp rootwait console=tty0 console=ttyMSM0,115200n8"

Graphical image (with GPU)

Instead of using the developer image as per the previous section, you can use the desktop image, e.g.

wget http://builds.96boards.org/snapshots/dragonboard820c/linaro/debian/latest/linaro-buster-alip-dragonboard-820c-*.img.gz
gunzip linaro-buster-alip-dragonboard-820c-*.img.gz
fastboot flash userdata linaro-buster-alip-dragonboard-820c-*.img

You can use the same boot image as mentioned in the previous section.

If all steps went fine, you should now have a Debian desktop with working GPU. The default image uses LxQt desktop, with the SDDM login manager. The desktop should be started by default with the linaro user, it can be stopped/restarted using systemctl commands, such as:

sudo systemctl stop sddm

Installing an Open Embedded based image

Initial support for DragonBoard 820c has been added into the OpenEmbedded QCOM BSP later, including the appropriate kernel recipe. To build an image for Dragonboard 820c , simply follow the same instructions as usual, from Dragonboard-410c-OpenEmbedded-and-Yocto. When you select the MACHINE to build for, pick dragonboard-820c.

The board has been added to the Linaro Reference Platform OpenEmbedded builds, and prebuilt images for this board are available here: http://builds.96boards.org/snapshots/dragonboard820c/linaro/openembedded/morty/latest/.

Kernel source code

The Linux kernel used for DragonBoard 820c can be found in the Linaro Qualcomm Landing Team git repository. For now the support for this board is preliminary and can only be found in either 'release' branches named as release/db820c/qcomlt-x.y (the latest one being the most up-to-date/recent) or the integration-linux-qcomlt branch, which is regularly rebased on recent mainline, and is used for developers.

git: http://git.linaro.org/landing-teams/working/qualcomm/kernel.git
branch: release/db820c/qcomlt-x.y
defconfig: arch/arm64/defconfig kernel/configs/distro.config

To build the Linux kernel, you can use the following instructions:

git clone -n http://git.linaro.org/landing-teams/working/qualcomm/kernel.git
cd kernel
git checkout -b db820c <remote branch>
export ARCH=arm64
export CROSS_COMPILE=<path to your GCC cross compiler>/aarch64-linux-gnu-
make defconfig distro.config
make -j4 Image dtbs KERNELRELEASE=`make kernelversion`-linaro-lt-qcom

Additionally, you might want or need to compile the kernel modules:

make -j4 modules KERNELRELEASE=`make kernelversion`-linaro-lt-qcom

To boot the kernel image, you will need a fastboot compatible boot image, and you can refer to Dragonboard-Boot-Image for instructions to create such an image. However, use the following cmdline instead of the one mentioned in the wiki:

export cmdline="root=/dev/sda9 rw rootwait console=ttyMSM0,115200n8"

Additional notes

Building the SD rescue image

The scripts to build the SD rescue image can be found here:

It should be fairly straight forward to run these scripts locally. In case of troubles, feel free to ask support on the 96boards forum.