Ventana Ubuntu
Ventana Ubuntu
Ventana Ubuntu
= Ubuntu on Ventana=
While Gateworks cannot fully support all Linux distros, it is relatively simple to
overlay a Gateworks Ventana kernel onto any non-Gateworks third party Linux distro
rootfs image. For a full list of Linux BSP's for Ventana see [wiki:ventana#bsp
here]
For a full Board Support Package providing building a Linux distro from source,
please see the OpenWrt, Yocto, or Android BSP from the [wiki:ventana#bsp Ventana
BSP] page
See also:
* The Gateworks Ventana [wiki:ventana#third_party_linux third party linux] page
for more details on how to use other linux distro on Ventana.
* [wiki:/ubuntu Gateworks Ubuntu Page for general notes]
[=#prebuilt]
== Gateworks pre-built Ubuntu Disk Images ==
Gateworks provides a pre-built Ubuntu firmware images for the Ventana Family:
* Compressed Disk Image containing boot firmware, kernel and root filesystem
'''(Recommended for microSD / eMMC booting)'''
- [http://dev.gateworks.com/ventana/images/focal-ventana.img.gz focal-
ventana.img.gz]
- To update the firmware on a microSD card see
[wiki:linux/blockdev#UsingaDiskImage]
* UBI images '''(Recommended for RAW NAND FLASH booting)'''
- [http://dev.gateworks.com/ventana/images/focal-ventana_normal.ubi focal-
ventana_normal.ubi] - UBI image for 2K page size 'normal' geometry FLASH
- [http://dev.gateworks.com/ventana/images/focal-ventana_large.ubi focal-
ventana_large.ubi] - UBI image for 4K page size 'large' geometry FLASH
- see [wiki:/linux/ubi/#flashgeometry here] to determine your flash geometry
- see [wiki:/linux/ubi#BasicMethod here] for info about flashing UBI images
* [http://dev.gateworks.com/ubuntu/focal/focal-ventana.tar.xz focal-armhf.tar.xz]
- tarball of rootfs (not including kernel) you can use to image onto microSD /
mSATA. See [wiki:linux/blockdev linux/blockdev] for instructions
* [http://dev.gateworks.com/ventana/images/linux-ventana.tar.xz linux-
ventana.tar.xz] Kernel, device-tree, bootscript, and modules that can be combined
with a root filesystem to create a bootable system. See [wiki:linux/blockdev
linux/blockdev] for instructions
Features:
- Ubuntu arm core (created via [https://github.com/gateworks/ubuntu-rootfs ubuntu-
rootfs.sh] debootstrap script)
- Gateworks Ventana Linux kernel (Linux 5.4 based)
- eth0 dhcp with a 30 second timeout
- User: root password: root
- Packages installed on top of core including:
* Updated modemmanager/libqmi-utils/libmbim-utils (see [wiki:ubuntu#modem
ubuntu/modem])
* Misc wireless: wpasupplicant iw
* Misc utils: vim can-utils i2c-tools usbutils pciutils screen watchdog binutils
* Misc network: wget ethtool iperf iperf3 openssh-server iptables
* Linux firmware
* mmc-utils from https://packages.debian.org/sid/utils/mmc-utils
* Gateworks [https://raw.githubusercontent.com/Gateworks/meta-
gateworks/master/recipes-support/hostapd-conf/hostapd-conf/hostapd-conf hostapd-
conf script]
* Filesystem tools: e2fstools parted
- first-boot script to grow root filesystem partition and filesystem (useful when
putting disk images on removable storage devices)
- use ifupdown tools instead of netplan (we find them easier to understand and
configure)
[[CollapsibleStart(Old Releases)]]
Old Releases:
* Ubuntu 16.04 LTS (Xenial Xerus) console image
- Important Notes:
- This is a mainline kernel that does not have Video Hardware Acceleration
support for gstreamer and a few other Gateworks specific items. For more
information, read [wiki:ventana#MainlineLinuxKernelsupport Gateworks Mainline Linux
Support].
- This requires the latest Gateworks Bootloader - U-Boot v2017.05 (see
http://dev.gateworks.com/ventana/images and
http://trac.gateworks.com/wiki/ventana/bootloader#PreBuiltBootloader)
- A pre-built console image created using the [#debootstrap debootstrap] method
for [http://releases.ubuntu.com/16.04/ Ubuntu 16.04 (Xenial Xerus)] can be
downloaded:
* [http://dev.gateworks.com/ventana/images/xenial-ventana_normal.ubi xenial-
ventana_normal.ubi] - UBI image for 2K page size 'normal' geometry FLASH (see
[wiki:/linux/ubi/#flashgeometry here] to determine your flash geometry)
- see [wiki:/linux/ubi#BasicMethod here] for info about flashing UBI images
- sha256sum: 000c3fb814f1c0605dd904cab1b77131a5a69e72a145158685d402f0f03aedbf
* [http://dev.gateworks.com/ventana/images/xenial-ventana_large.ubi xenial-
ventana_large.ubi] - UBI image for 4K page size 'large' geometry FLASH (see
[wiki:/linux/ubi/#flashgeometry here] to determine your flash geometry)
- see [wiki:/linux/ubi#BasicMethod here] for info about flashing UBI images
- sha256sum: 590b4bc6af10fd8ff07061e73479fc5511fbe718a8b20e16cc6d9051e3ae5151
* [http://dev.gateworks.com/ubuntu/xenial/xenial-armhf.tar.xz xenial-
armhf.tar.xz] - tarball of rootfs you can use to image onto microSD / mSATA
- see [wiki:linux/blockdev linux/blockdev] for instructions
- sha256sum: a03dede35c64a8e28a71279b262ae9092a29ca8fd7de0e09faba4c6cc1f1356b
- Features:
- Ubuntu 16.04 (from debootstrap instructions)
- Ubuntu Xenial kernel (Linux 4.11 based) with drivers/firmware
- custom bootscript supporting NAND/UBI, MMC, SATA, USB boot devices and root
filesystems
- extra packages: openssh-server can-utils i2c-tools usbutils pciutils
- eth0 dhcp
- user root passwd root
[[CollapsibleEnd]]
[=#rootfs]
[=#debootstrap]
== Building the Root Filesystem via debootstrap
A popular way to create a Ubuntu root filesystem is to use the {{{deboostrap}}}
utility on a Debian or Ubuntu host. This tool provides a 2-stage install where the
second stage is within a chroot environment using qemu-arm.
Requirements:
- Linux Ubuntu or Debian System with network connection and sudo permissions
- Linux Kernel
- Ventana target board with bootloader
- Boot device with 2GB+ of free space (micro-SD, USB mass storage, mSATA, 1GB/2GB
NAND flash)
Important notes:
* These steps are not always exactly what we do in our script but give you an idea
of how you would go about doing it yourself if you wanted to customize something
* We set and use '''target''' and '''distro''' env variables in step 2 and use
those env variables in the remaining steps to make this tutorial more version-
agnostic. Please be aware of this and do not deviate from the steps unless or until
you completely understand what you are doing.
* While operating under the qemu chroot (ie on the host system) you may encounter
'qemu: Unsupported syscall'. Note that messages from QEMU about unsupported
syscalls are often harmless, because typically they only appear for relatively new
syscalls which QEMU hasn't implemented yet. The guest code will have a fallback
path so it works on older kernels which don't implement the syscall, so a message
is printed but the application still runs. So if the guest program is failing then
it is quite likely to be for an entirely unrelated reason to the missing syscalls.
Steps:
1. Install pre-requisites:
{{{
#!bash
sudo apt-get install qemu-user-static debootstrap binfmt-support
}}}
3. we now have a minimal Ubuntu rootfs - chroot to it and perform the 2nd stage
install:
{{{
#!bash
sudo chroot $target
# now we are in the chroot
distro=focal
export LANG=C
# setup second stage
/debootstrap/debootstrap --second-stage
}}}
* this is the most minimal rootfs we would recommend
5. (optional) update package database and setup locales (do not skip this step if
you are needing to install any packages for the steps below or otherwise)
{{{
#!bash
apt-get update
apt-get -f install # fixup missing package dependencies
apt-get install locales dialog
dpkg-reconfigure locales
}}}
6. set hostname:
{{{
#!bash
echo ${distro}-armhf > /etc/hostname
}}}
EOF
}}}
- or static IP:
{{{#!bash
apt-get install net-tools ifupdown
cat <<EOF >> /etc/network/interfaces
allow-hotplug eth0
auto eth0
iface eth0 inet static
address 192.168.1.1
netmask 255.255.255.0
gateway 192.168.1.254
EOF
}}}
- or wireless (requires ~3MB of additional packages):
{{{
#!bash
apt-get install wpasupplicant iw
cat << EOF >> /etc/network/interfaces
# Wireless interface
auto wlan0
iface wlan0 inet dhcp
wireless_mode managed
wireless_essid any
wpa-driver nl80211
wpa-conf /etc/wpa_supplicant.conf
EOF
wpa_passphrase <myssid> <mypass> >> /etc/wpa_supplicant.conf
}}}
13. Now that the rootfs has been created, use one of the following options:
[=#desktop]
== Hardware Accelerated Desktop UI
While it is not typical to use an embedded system as an Ubuntu desktop we often are
asked how to do it.
With the Ubuntu Focal (20.04) all the software is in place to give you 2D and 3D
hardware acceleration with the IMX6 with a modern kernel such as the Linux 5.4
kernel we use in our pre-built images.
[=#kernel]
== Kernel
While a kernel is not specifically part of a root filesystem it usually resides on
the root filesystem. There are several kernel sources you can choose from:
* Gateworks pre-built 5.4 kernel (**recommended**)
* Ubuntu built kernel
* Kernel built by hand
If you want to clean out old kernels no longer used, you can remove the directory
of modules in /lib/modules/<kernel-version>
It is recommended that you use the Gateworks kernel above for the following
reasons:
* Ubuntu built kernels can require initrd for some boot devices complicating
things (ie NAND and USB Mass Storage are kernel modules)
* Ubuntu built kernels may be configured in ways not appropriate for Gateworks
boards (ie the DS1672 RTC driver is not static which complicates restoring system
time on boot from the GSC provided RTC)
If you wish to use an Ubuntu built kernel here are some notes but Gateworks can not
support you if you run into issues as we don't maintain this kernel.
To install a specific kernel image search for available packages and pick the
version you want. For example if wanting the 4-15.0-34-generic kernel:
{{{#!bash
apt-get update
apt-get install linux-image-4.15.0-34-generic
# install mkimage
apt-get install u-boot-tools
# create u-boot image for kernel
mkimage -A arm -O linux -T kernel -C none \
-a 0x10008000 -e 0x10008000 -n "linux" \
-d /boot/vmlinuz-4.15.0-34-generic /boot/uImage
# install device-tree blobs
cp /lib/firmware/4.15.0-34-generic/device-tree/imx6*-gw*.dtb /boot
#blacklist imx rtc driver, Gateworks board uses GSC RTC, and does not use imx RTC
echo "blacklist rtc_snvs" > /etc/modprobe.d/blacklist-rtc.conf
# create u-boot image for initrd
mkimage -A arm -O linux -T ramdisk \
-a 0x0 -e 0x0 -n "initrd" \
-d /boot/initrd.img-4.15.0-34-generic /boot/uramdisk
}}}
- use {{{apt-cache search linux-image}}} to determine what Ubuntu kernel versions
are available
If you want to clean out old kernels no longer used you can use {{{apt list
--installed | grep linux}}} to list installed packages and remove them (remove
linux-headers, linux-image, linux-modules for example). For example if you want to
remove the 4.15.0-42-generic packages:
{{{#!bash
apt purge linux-image-4.15.0-42-generic linux-modules-4.15.0-42-generic linux-
headers-4.15.0-42
}}}
- modify the above to remove the specific version(s) you want to remove
If booting from boot media that requires kernel modules you need to create an
initrd:
* The default Ubuntu kernel supports booting a microSD/SATA rootfs directly, but
lacks nand/ubifs/ubi/usb-storage support. If you need that (and have a large enough
flash to boot from that) you will need to use the Ubuntu initrd:
- add NAND/ubifs/usb-storage modules to the initrd:
{{{#!bash
cat << EOF >> /etc/initramfs-tools/modules
# for NAND/ubi
gpmi_nand
ubi mtd=2
ubifs
# for usb-storage
ci_hdrc_imx
usb-storage
EOF
update-initramfs -u # press 'Enter' when prompted
# create u-boot image for initrd
mkimage -A arm -O linux -T ramdisk \
-a 0x0 -e 0x0 -n "initrd" \
-d /boot/initrd.img-*-generic /boot/uramdisk
}}}
You will need to create a boot script that sets kernel cmdline properly based on
boot device and loads the Ubuntu initrd if needed. You can do this on the target
board:
{{{#!bash
# The Gateworks bootscript is a good starting point
wget https://raw.githubusercontent.com/Gateworks/linux-
imx6/gateworks_5.4.45/gwventana_bootscript -O /boot/6x_bootscript-ventana.txt
# re-enable ramdisk when its needed
sed -i 's/^setenv rd_addr$/#setenv rd_addr/' /boot/6x_bootscript-ventana.txt
mkimage -A arm -O linux -T script -n bootscript -d /boot/6x_bootscript-
ventana.txt /boot/6x_bootscript-ventana
}}}