This is BPS layer for LicheePi Zero Dock which enables most of it's media capabilities. Including:
- video engine (
h.264
decoder) - display engine (with
800x480p
LCD) - mipi-csi2 (with
ov5640
camera) - audio codec
Also following items are active too
- Ethernet (onboard 10/100Mbps LAN) with
dhcp
- WiFi (
rtl8723bs
SDIO module). Check/etc/wap_supplicant/wpa_supplicant-nl80211-wlan0.conf
- USB otg (
host
mode)
Before using LicheePi-Zero-Dock mipi-csi2 interface, please check v3s-mipi-csi2 repository. You need to do some hardware things!
- Clone required layers:
git clone git://git.yoctoproject.org/poky -b kirkstone
cd poky/
git clone https://github.com/linux-sunxi/meta-sunxi.git -b kirkstone
git clone https://github.com/openembedded/meta-openembedded.git -b kirkstone
git clone git@github.com:ArashEM/meta-licheepi-media.git -b kirkstone
cd ../
- Export template configuration path and initialize build environment
export TEMPLATECONF=${TEMPLATECONF:-meta-licheepi-media/conf}
source poky/oe-init-build-env licheepi-zero-dock
- Start build process
bitbake media-image
- Flash
wic
image into your SD card (it must begunzip
ed first)
sudo dd if=tmp/deploy/images/licheepi-zero-dock/media-image-licheepi-zero-dock.wic of=/dev/sdX
- Enjoy :-)
- Turn backlight on
echo 36 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio36/direction
echo 1 > /sys/class/gpio/gpio36/value
- Configure media pipeline
media-ctl -d /dev/sun6i-isp-media --set-v4l2 "'ov5647 0-0036':0[fmt:SBGGR10_1X10/1296x972 field:none]"
media-ctl -d /dev/sun6i-isp-media --set-v4l2 "'sun6i-mipi-csi2':1[fmt:SBGGR10_1X10/1296x972]"
media-ctl -d /dev/sun6i-isp-media --set-v4l2 "'sun6i-csi-bridge':1[fmt:SBGGR10_1X10/1296x972]"
media-ctl -d /dev/sun6i-isp-media --set-v4l2 "'sun6i-isp-proc':1[fmt:SBGGR10_1X10/1296x972]"
- Configure camera for automatic gain, exposure and white balancing
v4l2-ctl -d /dev/v4l-subdev3 --set-ctrl gain_automatic=1
v4l2-ctl -d /dev/v4l-subdev3 --set-ctrl auto_exposure=0
v4l2-ctl -d /dev/v4l-subdev3 --set-ctrl white_balance_automatic=1
- Start a pipeline from camera to LCD (gray scale mode)
gst-launch-1.0 v4l2src device=/dev/sun6i-isp-capture num-buffers=150 \
! video/x-raw,format=NV12,width=1296,height=972,framerate=30/1 \
! videoscale \
! video/x-raw,width=648,height=486 \
! videoconvert \
! fpsdisplaysink video-sink=fbdevsink sync=false
Note: I'm using 648x486
for scaling because it's easier for videoscale
to 1/4 image rather than 800x480
which is actual LCD size.
- You can configure your image before burning into SD card. for example setting
wpa-psk
.
first check start sector of interested partition
file media-image-licheepi-zero-dock.wic
media-image-licheepi-zero-dock.wic: DOS/MBR boot sector; partition 1 : ID=0xc, active, start-CHS (0x20,0,1), end-CHS (0x29f,3,32), startsector 4096, 81920 sectors; partition 2 : ID=0x83, start-CHS (0x2a0,0,1), end-CHS (0x3ff,3,32), startsector 86016, 1783808 sectors; partition 3 : ID=0x82, start-CHS (0x3ff,3,32), end-CHS (0x3ff,3,32), startsector 1871872, 204800 sectors
Then mount it via offset
argument:
sudo mount -o rw,offset=$((512*86016)) file media-image-licheepi-zero-dock.wic /mnt/
-
swap
partition is necessary! So consider using high speed SD card. Otherwise you may encounter issue usingGStreamer
. -
In order to compile
libcamera
with poky sdk you needjinja2
,ply
andpyyaml
. Which are not shipped with sdk. Easy way to install them is usingpip
. This way packages are install into/opt/sdk/sysroots/x86_64-pokysdk-linux/usr/lib/python3.10/site-packages
. It's local repository of packages inside sdk sysroot.
source /opt/sdk/environment-setup-cortexa7t2hf-neon-poky-linux-gnueabi
python3.10 -m ensurepip --upgrade
python3.10 -m pip install ply jinja2 pyyaml