Skip to content
This repository was archived by the owner on Jun 21, 2025. It is now read-only.
Luc Verhaegen edited this page Sep 24, 2019 · 15 revisions

We are of course using patches on top of mainline u-boot and mainline kernel.

Table of Contents

sd card

For now, we will use an sd-card as our storage.

Clean the sd-card:

dd if=/dev/zero of=/dev/mmcblk0 bs=1k count=1024

Partition the sd-card:

fdisk /dev/mmcblk0

This is what libv's 16GB sd cards look like:

Device         Boot  Start      End  Sectors  Size Id Type
/dev/mmcblk0p1        2048   264191   262144  128M  c W95 FAT32 (LBA)
/dev/mmcblk0p2      264192 31257599 30993408 14.8G 83 Linux

Now create filesystems:

mkfs.vfat /dev/mmcblk0p1
mkfs.ext4 /dev/mmcblk0p2

rootfs

Creating a debian rootfs with debootstrap is described on the sunxi wiki.

toolchain

If you are using a debian based operating system, you can just apt-get install a cross-compiler.

Since libv is using opensuse still, he had to go and get a tarballed toolchain from linaro.

This was untarred to /home/libv/fosdem/gcc-linaro-7.3.1-2018.05-x86_64_arm-linux-gnueabihf/bin/, and it's path was added to PATH:

export PATH="$PATH":/home/libv/fosdem/video-new/gcc-linaro-7.3.1-2018.05-x86_64_arm-linux-gnueabihf/bin/

u-boot

Our version of U-boot is current with the latest official release, namely v2019-07.

The changes are:

  • enabling the 3.5" LCD for boot status.
  • adding GMAC_TX_DELAY=3 for the lime2's newer phyceiver
  • disabling hdmi as we want uboot to only show on the lcd.
  • enable simplefb
The sunxi u-boot howto is fully relevant, but below is the main points repeated anyway.

Clone

Clone the repo, master holds the relevant changes:

git clone https://github.com/libv/fosdem-video-u-boot

Build

make CROSS_COMPILE=arm-linux-gnueabihf- A20-OLinuXino-Lime2-fosdem_defconfig
make -j4 CROSS_COMPILE=arm-linux-gnueabihf-

Install

Clean:

dd if=/dev/zero of=/dev/mmcblk0 bs=1k count=1023 seek=1
Install:
dd if=u-boot-sunxi-with-spl.bin of=/dev/mmcblk0 bs=1k seek=8

Configure

Add the file boot.cmd to the filesytem at /dev/mmcblk0p1:

fatload mmc 0 0x46000000 zImage
fatload mmc 0 0x49000000 sun7i-a20-olinuxino-lime2-fosdem.dtb
setenv bootargs console=ttyS0,115200 console=tty0 consoleblank=0 root=/dev/mmcblk0p2 rootwait panic=10 ${extra}
bootz 0x46000000 - 0x49000000

Now run to following to convert boot.cmd to boot.scr (mkimage is part of package u-boot-tools):

mkimage -C none -A arm -T script -d boot.cmd boot.scr

kernel

Our kernel is currently based on v5.2, and has the following changes on top:

  • Enables the 3.5" LCD.
  • Adds cedrus, a mpeg/h.264/h.265 encoder (unused)
  • Adds a device specific config and devicetree.
  • Adds the sun4i_csi1 capture driver.
  • fix hdmi clocking to work with u-boot ignoring hdmi
  • fix lcd simplefb setup so the panel does not bleed and so it keeps its backlight enabled
  • fixes all sorts of kms issues

Clone

git clone https://github.com/libv/fosdem-video-linux

Build

Configure:

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- sunxi_fosdem_defconfig

Build:

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j4 zImage modules dtbs

Install

Copy arch/arm/boot/zImage to the boot partition at mmcblk0p1.

Copy arch/arm/boot/dts/sun7i-a20-olinuxino-lime2-fosdem.dtb to the boot partition at mmcblk0p1.

Assuming that mmcblk0p2 is mounted at /mnt, run

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j4 INSTALL_MOD_PATH=/mnt/ modules_install

Add a user

As root, run:

adduser <username>

And make him part of the video group:

adduser <username> video

Set up key based login

Assuming that you want the same authorized keys for root to apply to the user:

mkdir /home/username/.ssh
chmod 700 /home/username/.ssh
cp .ssh/authorized_keys /home/username/.ssh/
chown -R username.username /home/username/.ssh/

juggler

Our capture/display tool ties the capture to the KMS displays.

It will run on the target device, so it is best to clone and build it there.

prerequisites

You will want to install a few packages:

  • build-essential
  • git
  • pkg-config
  • libdrm-dev
  • libpng-dev

DRM_FORMAT_R8_G8_B8

Edit /usr/include/libdrm/drm_fourcc.h , and add:

#define DRM_FORMAT_R8_G8_B8    fourcc_code('P', 'R', 'G', 'B')
Before the closing #endif.

clone

git clone https://github.com/libv/fosdem-video-juggler

Build

make

Run

Make sure that hdmi is connected, and run:

./juggler

This will capture and test 1000 frames, and then stop displaying, while endlessly displaying the last frame. You can add an optional number to test more frames.

Use Ctrl-C to halt this program.

Test Output

You need to currently still have a valid test device attached. Your useful options are any other allwinner A20 based device, like another lime2, or our ubiquitous Banana-Pi M1.

You should be able to copy the SD card you just created, or start afresh.

Banana Pi M1

If you are using the Banana Pi M1, then you need to install another u-boot, and another DTB file:

For u-boot, build Bananapi_defconfig

For dtb, choose arch/arm/boot/dts/sun7i-a20-bananapi.dtb

Necessary changes

You will want to change the hostname in /etc/hostname.

You also want to generate new ssh keys:

rm /etc/ssh/ssh_host_*
dpkg-reconfigure openssh-server

Instead of restarting network and sshd, it's probably faster to just reboot.

Test output tool

Run:

./test_output 1000000

To start outputting 1M sequential frames, that the juggler tool currently tests for.

Clone this wiki locally