[[PageOutline]] = Debian on Ventana = Debian Linux can be run on the Ventana Single Board Computers, '''however it is not one of the primary OS that is supported by Gateworks. For more primary support, we recommend [wiki:ventana/ubuntu Ubuntu]''' 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] See the Gateworks Ventana [wiki:ventana#third_party_linux third party linux] page for more details on how to use other linux distor on Ventana. [=#debootstrap] == Build your own Ubuntu rootfs via debootstrap == The preferred way to create a Debian 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. Debian has been supporting armhf builds since Debian 7 (aka "wheezy"). Prior to that they supported armel (software float for ARMv6 architecture). Requirements: - Linux Ubuntu or Debian System with network connection and sudo permissions - Linux Kernel (choose either Gateworks latest pre-built 3.14 kernel with full hardware support, a vanilla mainline kernel (missing full video in/out support but more up-to-date), or a kernel of your own) - see below steps for more detail - Ventana target board with bootloader - boot device with 300MB+ of free space (micro-SD, USB mass storage, mSATA, 2GB NAND flash) Important notes: * 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 distro-agnostic. Please be aware of this and do not deviate from the steps unless or until you completely understand what you are doing. Steps: 1. Install pre-requisites: {{{ #!bash sudo apt-get install qemu-user-static debootstrap binfmt-support }}} 2. Perform first stage install of minimal filesystem: {{{ #!bash target=rootfs distro=jessie # or wheezy sudo debootstrap --arch=armhf --foreign $distro $target # copy qemu-arm-static binary for the binfmt packages to find it and copy in resolv.conf from host sudo cp /usr/bin/qemu-arm-static $target/usr/bin sudo cp /etc/resolv.conf $target/etc }}} * See https://www.debian.org/releases/ for a list of current Debian releases - Debian has supported armhf since Debian 7 (wheezy) * this minimal rootfs is appx 177MB (jessie) however it is still missing some core packages and configuration before it can be booted. These steps are taken care of in a 2nd stage install within a chroot shell * the chroot shell below will provide network support (inherited from the host and why we copied /etc/resolv.conf from the host for nameservice) 3. we now have a minimal Debian rootfs - chroot to it and perform the 2nd stage install: {{{ #!bash sudo chroot $target # now we are in the chroot distro=jessie export LANG=C # setup second stage /debootstrap/debootstrap --second-stage }}} * now we have a bootable image of about 265MB 4. (optinal) configure apt package repos: {{{ #!bash cat < /etc/apt/sources.list deb http://ftp.uk.debian.org/debian $distro main contrib non-free deb-src http://ftp.uk.debian.org/debian $distro main contrib non-free deb http://ftp.uk.debian.org/debian $distro-updates main contrib non-free deb-src http://ftp.uk.debian.org/debian $distro-updates main contrib non-free deb http://security.debian.org/debian-security $distro/updates main contrib non-free deb-src http://security.debian.org/debian-security $distro/updates main contrib non-free EOT }}} * you may want to add additional package feeds at this point, depending on your needs 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 install locales dialog dpkg-reconfigure locales }}} 6. set hostname: {{{ #!bash echo myname.mydomain > /etc/hostname }}} 7. create a default fstab: {{{ #!bash cat < /etc/fstab /dev/root / auto defaults 1 1 EOT }}} * Note that this not required if you pass in 'rw' on the kernel cmdline. However while that is the default for the Ventana bootscripts for removeable storage it is not for NAND boot, therefore we will add a default fstab that will re-mount the kernel mounted rootfs as read-write * /dev/root in /etc/fstab will refer to the rootfs mounted by the kernel, thus the above entry simply re-mounts rootfs as read-write 8. set a root passwd so you can login {{{ #!bash passwd }}} - or consider adding a user via {{{adduser myuser}}} but if you do so you will want to install sudo and add this user to the sudo group {{{ #!bash adduser myuser usermod -a -G tty myuser # add to tty group for tty access usermod -a -G dialout myuser # add to dialout group for UART access usermod -a -G sudo myuser # add to sudo group for root access }}} 9. (optional) configure networking: - wired ethernet with DHCP on eth0 {{{ #!bash cat <> /etc/network/interfaces allow-hotplug eth0 iface eth0 inet dhcp EOF }}} - or static IP: {{{ #!bash cat <> /etc/network/interfaces allow-hotplug 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 >> /etc/wpa_supplicant.conf }}} 10. enable serial console for imx {{{ #!bash echo T0:2345:respawn:/sbin/getty -L ttymxc1 115200 vt100 >> /etc/inittab }}} 11. (optional) install some useful packages {{{ #!bash apt-get install ntpdate # time sync with ntp server apt-get install openssh-server # ssh server for remote access apt-get install can-utils i2c-tools usbutils pciutils # cmdline tools for various Ventana support }}} * Note that by default root ssh access is disabled for security. See [#ssh below] for info on enabling it * Note that at this point, prior to exiting the chroot, you could continue to configure your system by adding packages and configuration files. You could even install development tools via the '''build-essential''' meta-package and build and install sources such as the kernel below (adds appx 180MB). See [wiki:linux/kernel#building] for information on how to select and build a kernel 12. install a kernel and kernel support (kernel+dtbs+modules+firmware): {{{ #!bash cd / wget http://dev.gateworks.com/ventana/images/gateworks-linux-imx6-3.14.48.tar.gz tar -xvf gateworks-linux-imx6-3.14.48.tar.gz depmod $(ls /lib/modules/) # create module dependencies rm gateworks-linux-imx6-3.14.48.tar.gz }}} * you can either download a pre-built kernel tarball or build one yourself with features you desire - see linux/kernel for more info * exiting the chroot, you could continue to configure your system by adding packages and configuration files. You could even install development tools via the build-essential meta-package and build and install sources such as the kernel below (adds appx 180MB). See linux/kernel for information on how to select and build a kernel * the depmod trick above is to run depmod with the exact kernel version (which will be the subdir in /lib/modules). An alternative is to run depmod after the first boot 13. exit the chroot shell and remove files we no longer need {{{ #!bash exit sudo rm $target/etc/resolv.conf sudo rm $target/usr/bin/qemu-arm-static }}} 14. install to bootable media (ie a block storage device supported by your board such as a USB Mass Storage device, a microSD, an mSATA SSD. There are many choices that could be made here. The example below will create a single ext4 rootfs partition on a removable block storage device. Ensure you set DEVICE properly for your system. {{{ #!bash DEVICE=/dev/sdc # adjust per your system! MNT=/mnt # adjust per your system # unmount all auto-mounted partitions for this device sudo umount ${DEVICE}? # partition disk - single ext partition at 1MiB printf "2048,,L,,\n" | sudo sfdisk -uS ${DEVICE} sync sudo mkfs.ext4 -O ^64bit -L rootfs ${DEVICE}1 # mount partition (will mount to /media/rootfs/) sudo mount ${DEVICE}1 $MNT # copy the root filesystem sudo cp -rupv $target/* $MNT/ # unmount the disk sudo umount ${DEVICE}1 }}} == See Also == See Also: * [wiki:/ventana/ubuntu#gstreamer-imx ventana/ubuntu#gstreamer-imx] - Adding GStreamer IPU/VPU/GPU support to Ubuntu * [wiki:/ventana/ubuntu#ssh ventana/ubuntu#ssh] - ssh server config * [https://www.debian.org/distrib/packages Debian Software Repositories]