Debian Build Release: Difference between revisions

From Variscite Wiki
Line 56: Line 56:
Or, to build for i.MXQXP SOC revision B0:
Or, to build for i.MXQXP SOC revision B0:
  $ cd {{#var:BUILD_FOLDER}}
  $ cd {{#var:BUILD_FOLDER}}
$ {{#var:BUILD_SCRIPT_B0}} -c all "|"& tee build.log
"$ {{#var:BUILD_SCRIPT_B0}} -c all <pre>|& tee build.log"
|}}|}}
|}}|}}



Revision as of 02:54, 7 July 2020

DART-6UL - Debian Stretch 9.3 with imx_4.14.78_1.0.0_ga_var01 Linux release
DART-6UL in this wiki refers to both the Variscite DART-6UL and VAR-SOM-6UL SOMs.

Overview

This page describes how to build and install Debian distribution (Stretch) on Variscite boards with DART-6UL.

These instructions were tested on an Ubuntu 16.04 x64 host PC. When using other distributions, there may be problems.

Please note that the build script is based on debootstrap. As described in the following instructions, it's kindly suggested to create the build folder on the main Ubuntu volume on your host PC rather than an external media.
Using an external media, although automatically mounted, will cause debootstrap to complain about access rights (even when running the script with sudo).

Create build environment

Installing required packages

On Ubuntu building machine:

$ sudo apt-get install binfmt-support qemu qemu-user-static debootstrap kpartx \
lvm2 dosfstools gpart binutils bison git lib32ncurses5-dev python-m2crypto gawk wget \
git-core diffstat unzip texinfo gcc-multilib build-essential chrpath socat libsdl1.2-dev \
autoconf libtool libglib2.0-dev libarchive-dev python-git xterm sed cvs subversion \
kmod coreutils texi2html bc docbook-utils python-pysqlite2 help2man make gcc g++ \
desktop-file-utils libgl1-mesa-dev libglu1-mesa-dev mercurial automake groff curl \
lzop asciidoc u-boot-tools mtd-utils device-tree-compiler flex

Deploy source

Download archive containing the build script and support files for building Debian Stretch for this board:

$ cd ~
$ git clone https://github.com/varigit/debian-var.git -b debian_stretch_mx6ul_var03 var_mx6ul_dart_debian

Create environment (Internet connection should be available):

$ cd ~/var_mx6ul_dart_debian
$ ./make_var_mx6ul_dart_debian.sh -c deploy

This environment prepared to build.

Make Debian

Build all

Internet connection should be available

$ cd ~/var_mx6ul_dart_debian
$ sudo ./make_var_mx6ul_dart_debian.sh -c all |& tee build.log

In case you are using a SOM with NAND flash, run the following command as root to install Debian on it:

# debian-nand.sh

In case you are using a SOM with eMMC, run the following command as root to install Debian on it:

# debian-emmc.sh

The above scripts are located in /usr/sbin in the rootfs of the SD card used to boot Debian.

How-to: Test and use an interface

Please see this section in the Yocto developer guide page. It is the same for Debian.

How-to: Modify the kernel configuration

To modify the kernel configuration (add/remove features and drivers) please follow the steps below:

1. $ cd ~/var_mx6ul_dart_debian/src/kernel
2. $ sudo make ARCH=arm mrproper
3. $ sudo make ARCH=arm imx_v7_var_defconfig
4. $ sudo make ARCH=arm menuconfig
5. Navigate the menu and select the desired kernel functionality
6. Exit the menu and answer "Yes" when asked "Do you wish to save your new configuration?"
7. $ sudo make ARCH=arm savedefconfig
8. $ sudo cp arch/arm/configs/imx_v7_var_defconfig arch/arm/configs/imx_v7_var_defconfig.orig
9. $ sudo cp defconfig arch/arm/configs/imx_v7_var_defconfig
10. Follow the instructions above to rebuild kernel and modules, repack rootfs images and recreate SD card

Build a sample C "Hello, world!" program

Create a file called myhello.c with the following content:

#include <stdio.h>

int main() {
	printf("Hello, World!\n");
	return 0;
}

Export the C (cross-)compiler path:

$ export CC=~/var_mx6ul_dart_debian/toolchain/gcc-linaro-6.3.1-2017.05-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc

Compile:

$ $CC myhello.c -o myhello

Now you should have an app called myhello, that can be run on your target board.
You can add it to your rootfs image or copy it directly to the rootfs on the board (using scp, for example).