Skip to content
This repository was archived by the owner on Jun 21, 2025. It is now read-only.
Luc Verhaegen edited this page Jul 25, 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 -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

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

hdmi_test

Our current test code contains two utilities, one for outputting a test image using KMS, and for capturing it and verifying it contents using V4L2.

It will run on the target devices. I used a banana-pi for hdmi output, and the lime2 with adapter for input. So it is best to clone and build the small utilities there.

prerequisites

You will want to install a few packages:

  • build-essential
  • git

clone

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

Build

make

Output

Run the following to display 1 million frames.

./hdmi_output 1000000

Capture

./hdmi_capture

Clone this wiki locally