Debian Build Release: Difference between revisions

From Variscite Wiki
Line 69: Line 69:
  $ sudo {{#var:BUILD_SCRIPT_B0}} -c bootloader
  $ sudo {{#var:BUILD_SCRIPT_B0}} -c bootloader
|}}|}}
|}}|}}
<!-- Set release according to "release" parameter in URL and use PYRO_V1.0_VAR-SOM-MX6 as default
--> {{#vardefine:RELEASE_PARAM|{{#urlget:release}}}} <!--
--> {{#lst:Debian_Platform_Customization|{{#var:RELEASE_PARAM|RELEASE_BUSTER_V1.0_DART-MX8M-MINI}}}} <!--
--> {{PageHeader|{{#var:HARDWARE_NAME}} - Debian Customizing the Linux kernel}} {{DocImage|category1={{#var:HARDWARE_NAME}}|category2=Debian}} __toc__
<br>
This section describes how to do menuconfig and build new kernel configuration and deploy it.
= Configuring the kernel =
The default kernel configuration file used by Debian is part of the kernel source tree and is located at:
arch/{{#ifeq: {{#var:SOC_SERIES}}|imx8|arm64|arm}}/configs/{{#var:KERNEL_DEFCONFIG}}
<br>
To configure the kernel using Debian:<br>
= How-to: Modify the kernel configuration =
To modify the kernel configuration (add/remove features and drivers) please follow the steps below: <br>
$ cd {{#var:BUILD_FOLDER}}/src/kernel
$ sudo make ARCH={{#var:ARCH}} mrproper
$ sudo make ARCH={{#var:ARCH}} {{#var:KERNEL_DEFCONFIG}}
$ sudo make ARCH={{#var:ARCH}} menuconfig
Navigate the menu and select the desired kernel functionality <br>
Exit the menu and answer "Yes" when asked "Do you wish to save your new configuration?" <br>
$ sudo make ARCH={{#var:ARCH}} savedefconfig
$ sudo cp arch/{{#var:ARCH}}/configs/{{#var:KERNEL_DEFCONFIG}} arch/{{#var:ARCH}}/configs/{{#var:KERNEL_DEFCONFIG}}.orig
$ sudo cp defconfig arch/{{#var:ARCH}}/configs/{{#var:KERNEL_DEFCONFIG}}
== Building New Kernel Configuration ==


=== Build kernel, dtb files and kernel modules ===
=== Build kernel, dtb files and kernel modules ===
  $ cd {{#var:BUILD_FOLDER}}
  $ cd {{#var:BUILD_FOLDER}}
  $ sudo {{#var:BUILD_SCRIPT}} -c kernel
  $ sudo {{#var:BUILD_SCRIPT}} -c kernel
Line 80: Line 110:
  $ sudo {{#var:BUILD_SCRIPT_B0}} -c modules
  $ sudo {{#var:BUILD_SCRIPT_B0}} -c modules
|}}|}}
|}}|}}
{{Note|Note: If you have modules newly added/removed, make sure you run below command. }}
$ sudo MACHINE=imx8mm-var-dart ./var_make_debian.sh -c rtar
This will create rootfs.tar.gz that contains your new modules.
== Deploy Kernel and DTB ==
You can deploy the kernel and dtb or modules from any of the below methods,
== Deploy Kernel, dtb via network ==
=== Updating Device tree to target ===
Transfer dtbs to target <br>
On PC:
$ cd {{#var:BUILD_FOLDER}}
{{#ifeq: {{#var:SOC_SERIES}}|imx8|
$ scp output/*.dtb root@<yourboard-ip>:/boot/
|
$ scp output/*.dtb root@<yourboard-ip>:/tmp/
}}
Once prompted give root as password. <yourboard-ip> is ipaddress of your board. <br>
{{Note|Note: If you just intend to do dtb, then only follow this section and reboot the target}} <br>
Once transfer is done, follow below commands <br>
On Target Console
{{#ifeq: {{#var:SOC_SERIES}}|imx8|
<pre>
# sync;reboot
</pre>
|
<pre>
# mkdir -p /media/boot/
# mount /dev/mmcblk1p1 /media/boot/
# cp /tmp/*.dtb /media/boot/;sync;reboot
</pre>
}}
=== Updating kernel image to target ===
Transfer the output/{{#var:KERNEL_IMAGE}} kernel image to target <br>
On PC:
$ scp output/{{#var:KERNEL_IMAGE}} root@<yourboard-ip>:{{#ifeq: {{#var:SOC_SERIES}}|imx8|/boot/|/tmp/}}
Once prompted give root as password. <yourboard-ip> is ipaddress of your board.<br>
Once transfer is done, follow below commands <br>
On Target Console:<br>
{{#ifeq: {{#var:SOC_SERIES}}|imx8|
<pre>
# sync;reboot
</pre>
|
<pre>
# mkdir -p /media/boot/
# mount /dev/mmcblk1p1 /media/boot/
# cp /tmp/*.dtb /media/boot/;sync;reboot
</pre>
}}


=== Build rootfs ===
=== Build rootfs ===

Revision as of 01:59, 16 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


Build by parts

Build bootloader

$ cd ~/var_mx6ul_dart_debian
$ sudo ./make_var_mx6ul_dart_debian.sh -c bootloader


DART-MX8M-MINI - Debian Customizing the Linux kernel


This section describes how to do menuconfig and build new kernel configuration and deploy it.

Configuring the kernel

The default kernel configuration file used by Debian is part of the kernel source tree and is located at:

arch/arm64/configs/imx8_var_defconfig


To configure the kernel using Debian:

How-to: Modify the kernel configuration

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

$ cd ~/var_mx8mm_dart_debian_buster/src/kernel
$ sudo make ARCH=arm64 mrproper
$ sudo make ARCH=arm64 imx8_var_defconfig
$ sudo make ARCH=arm64 menuconfig

Navigate the menu and select the desired kernel functionality

Exit the menu and answer "Yes" when asked "Do you wish to save your new configuration?"

$ sudo make ARCH=arm64 savedefconfig
$ sudo cp arch/arm64/configs/imx8_var_defconfig arch/arm64/configs/imx8_var_defconfig.orig
$ sudo cp defconfig arch/arm64/configs/imx8_var_defconfig

Building New Kernel Configuration

Build kernel, dtb files and kernel modules

$ cd ~/var_mx8mm_dart_debian_buster
$ sudo MACHINE=imx8mm-var-dart ./var_make_debian.sh -c kernel
$ sudo MACHINE=imx8mm-var-dart ./var_make_debian.sh -c modules


Note: If you have modules newly added/removed, make sure you run below command.
$ sudo MACHINE=imx8mm-var-dart ./var_make_debian.sh -c rtar

This will create rootfs.tar.gz that contains your new modules.

Deploy Kernel and DTB

You can deploy the kernel and dtb or modules from any of the below methods,

Deploy Kernel, dtb via network

Updating Device tree to target

Transfer dtbs to target
On PC:

$ cd ~/var_mx8mm_dart_debian_buster
$ scp output/*.dtb root@<yourboard-ip>:/boot/

Once prompted give root as password. <yourboard-ip> is ipaddress of your board.

Note: If you just intend to do dtb, then only follow this section and reboot the target


Once transfer is done, follow below commands
On Target Console

# sync;reboot

Updating kernel image to target

Transfer the output/Image.gz kernel image to target
On PC:

$ scp output/Image.gz root@<yourboard-ip>:/boot/

Once prompted give root as password. <yourboard-ip> is ipaddress of your board.
Once transfer is done, follow below commands
On Target Console:

# sync;reboot

Build rootfs

Internet connection should be available

$ cd ~/var_mx8mm_dart_debian_buster
$ sudo MACHINE=imx8mm-var-dart ./var_make_debian.sh -c rootfs


Pack rootfs

To create the root file system archive (rootfs.tar.gz), run the following commands:

$ cd ~/var_mx8mm_dart_debian_buster
$ sudo MACHINE=imx8mm-var-dart ./var_make_debian.sh -c rtar


Create boot SD card

  1. Follow the above steps for make rootfs, kernel, bootloader;
  2. Insert the SD card to card reader connected to a host system;
  3. Run the following commands (Caution! All data on the card will be destroyed):
$ cd ~/var_mx8mm_dart_debian_buster
$ sudo MACHINE=imx8mm-var-dart ./var_make_debian.sh -c sdcard -d /dev/sdX


where '/dev/sdX' path to the block SD device in your system.

Boot the board with a bootable SD card

Setting the Boot Mode

Make sure the BOOT SELECT DIP switch on the carrier board is set correctly before you power on the board.

SW7
 0 : Boot from SD card
 1 : Boot from eMMC


Device tree selection in U-Boot

As shown in the Build Results table above, we have different kernel device trees, corresponding to our different H/W configurations (sometimes they are renamed without the "Image.gz-" prefix).

In U-Boot, set the device tree file manually:

$ setenv fdt_file YOUR_DTB_FILE
$ saveenv


Build Results

The resulted images are located in ~/var_mx8mm_dart_debian_buster/output/.

Image name
How to use
rootfs.tar.gz Root filesystem tarball used for installation on SD card and eMMC
Image.gz Linux kernel image
imx-boot-sd.bin U-Boot built for SD card and eMMC
Device Tree name
Details
fsl-imx8mm-var-dart.dtb Device tree blob for SD, eMMC, WIFI and LVDS display configuration.


Linux console access

User name User password User descriptor
root root system administrator
user user local user
x_user used for X session access

Please note: Vivante libraies for this release do not support X11, only weston backend is provided

Flash images to eMMC

To install Debian to the on-SOM eMMC, run the following command as root:

# install_debian.sh

The above script is 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_mx8mm_dart_debian_buster/src/kernel
2. $ sudo make ARCH=arm64 mrproper
3. $ sudo make ARCH=arm64 imx8_var_defconfig
4. $ sudo make ARCH=arm64 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=arm64 savedefconfig
8. $ sudo cp arch/arm64/configs/imx8_var_defconfig arch/arm64/configs/imx8_var_defconfig.orig
9. $ sudo cp defconfig arch/arm64/configs/imx8_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_mx8mm_dart_debian_buster/toolchain/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-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).

Running X11 Applications via Xwayland

Since Vivante libraries for this release do not support X11 backend, only weston backend is provided, so if you want to run x11 based application
refer to XWayland Example