Debian Build Release: Difference between revisions
Tag: Undo |
|||
(164 intermediate revisions by 8 users not shown) | |||
Line 1: | Line 1: | ||
<!-- Set release according to "release" parameter in URL and use | <!-- Set release according to "release" parameter in URL and use RELEASE_STRETCH_V3.0_DART-6UL as default | ||
--> {{ | --> {{INIT_RELEASE_PARAM|RELEASE_STRETCH_V3.0_DART-6UL}} <!-- | ||
--> {{#lst:Debian_Platform_Customization|{{#var:RELEASE_PARAM | --> {{#lst:Debian_Platform_Customization|{{#var:RELEASE_PARAM}}}} <!-- | ||
--> {{PageHeader|{{#var:HARDWARE_NAME}} - Debian {{#var:DEBIAN_NAME}} {{#var:DEBIAN_VERSION}} with {{#var:KERNEL_BRANCH}} Linux release}} {{DocImage|category1={{#var:HARDWARE_NAME}}|category2=Debian}} | --> {{PageHeader|{{#var:HARDWARE_NAME}} - Debian {{#var:DEBIAN_NAME}} {{#var:DEBIAN_VERSION}} with {{#var:KERNEL_BRANCH}} Linux release}} {{DocImage|category1={{#var:HARDWARE_NAME}}|category2=Debian}} | ||
{{#ifeq: {{#var:HARDWARE_NAME}} | DART-6UL |{{Note|DART-6UL in this wiki refers to both the Variscite DART-6UL and VAR-SOM-6UL SOMs.}}|}} | |||
__toc__ | |||
= Overview = | = Overview = | ||
This page describes how to build and install Debian distribution ({{#var:DEBIAN_NAME}}) on Variscite boards with {{#var:HARDWARE_NAME}}. | This page describes how to build and install Debian distribution ({{#var:DEBIAN_NAME}}) on Variscite boards with {{#var:HARDWARE_NAME}}. | ||
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.<br> | |||
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 = | = Create build environment = | ||
These instructions were tested on '''Ubuntu {{#ifexpr: {{#var:DEBIAN_VERSION}} < 10 | 16.04/18.04 | {{#ifexpr: {{#var:DEBIAN_VERSION}} < 12 | 18.04/20.04 | 20.04/22.04 }} }} x64 host PCs'''. When using other distributions, there may be issues. | |||
{{Note|'''Note:''' Variscite provides Docker containers that can be used for a development environment as an alternative to using a virtual machine or a dedicated computer. | |||
To learn more, please see Variscite's [[Docker_Build_Environment | Docker Build Environment]] guide. | |||
Windows with WSL/WSL2 is not supported for development}} | |||
== Installing required packages == | == Installing required packages == | ||
Line 16: | Line 24: | ||
$ sudo apt-get install binfmt-support qemu qemu-user-static debootstrap kpartx \ | $ sudo apt-get install binfmt-support qemu qemu-user-static debootstrap kpartx \ | ||
lvm2 dosfstools gpart binutils git lib32ncurses5-dev | lvm2 dosfstools gpart binutils bison git lib32ncurses5-dev libssl-dev gawk wget \ | ||
git-core diffstat unzip texinfo gcc-multilib build-essential chrpath socat libsdl1.2-dev \ | git-core diffstat unzip texinfo gcc-multilib build-essential chrpath socat libsdl1.2-dev \ | ||
autoconf libtool libglib2.0-dev libarchive-dev | autoconf libtool libglib2.0-dev libarchive-dev xterm sed cvs subversion \ | ||
coreutils texi2html bc docbook-utils | kmod coreutils texi2html bc docbook-utils help2man make gcc g++ \ | ||
desktop-file-utils libgl1-mesa-dev libglu1-mesa-dev mercurial automake groff curl \ | desktop-file-utils libgl1-mesa-dev libglu1-mesa-dev mercurial automake groff curl \ | ||
lzop asciidoc u-boot-tools mtd-utils device-tree-compiler | lzop asciidoc u-boot-tools mtd-utils device-tree-compiler flex cmake zstd udisks2 libgnutls28-dev \ | ||
python-pysqlite2 python-git python-m2crypto python-pyelftools | |||
{{#ifexpr: {{#var:DEBIAN_VERSION}} >= 10 |<br> | |||
While installing the packages, Ubuntu 20.04 users may receive the warning | |||
<pre> | |||
Package python-git is not available, ... | |||
</pre> | |||
Since the package is only available in up to Ubuntu 18.04, just ignore it and run: | |||
<pre> | |||
$ sudo apt-get install python3-git python3-m2crypto python3-pyelftools | |||
</pre> | |||
Note: If you are using Ubuntu 20.04 the QEMU package must be updated to latest version (>= 1:4.2-3ubuntu6.19). <br> | |||
To check the currently installed version of the qemu-user-static package on Ubuntu 20.04 LTS, use the below command:<br> | |||
$ apt list qemu-user-static | |||
|}} | |||
== Deploy source == | == Deploy source == | ||
{{DEBIAN_CODEAURORA_MIGRATION_NOTE}} | |||
Download archive containing the build script and support files for building Debian {{#var:DEBIAN_NAME}} for this board: | Download archive containing the build script and support files for building Debian {{#var:DEBIAN_NAME}} for this board: | ||
Line 34: | Line 58: | ||
$ cd {{#var:BUILD_FOLDER}} | $ cd {{#var:BUILD_FOLDER}} | ||
$ {{#var:BUILD_SCRIPT}} -c deploy | $ {{#var:BUILD_SCRIPT}} -c deploy | ||
{{#ifeq: {{#var:HARDWARE_NAME}} | VAR-SOM-MX8X |{{#ifeq: {{#var:MACHINE_NAME_B0}} | imx8qxpb0-var-som | | |||
Or, to build for i.MXQXP SOC revision B0: | |||
$ cd {{#var:BUILD_FOLDER}} | |||
$ {{#var:BUILD_SCRIPT_B0}} -c deploy | |||
|}}|}} | |||
This environment prepared to build. | This environment prepared to build. | ||
Line 43: | Line 71: | ||
$ cd {{#var:BUILD_FOLDER}} | $ cd {{#var:BUILD_FOLDER}} | ||
$ sudo {{#var:BUILD_SCRIPT}} -c all | tee | $ sudo {{#var:BUILD_SCRIPT}} -c all |& tee build.log | ||
{{#ifeq: {{#var:HARDWARE_NAME}} | VAR-SOM-MX8X |{{#ifeq: {{#var:MACHINE_NAME_B0}} | imx8qxpb0-var-som | | |||
Or, to build for i.MXQXP SOC revision B0: | |||
$ cd {{#var:BUILD_FOLDER}} | |||
$ sudo {{#var:BUILD_SCRIPT_B0}} -c all | |||
|}}|}} | |||
== Build by parts == | == Build by parts == | ||
Line 51: | Line 84: | ||
$ cd {{#var:BUILD_FOLDER}} | $ cd {{#var:BUILD_FOLDER}} | ||
$ sudo {{#var:BUILD_SCRIPT}} -c bootloader | $ sudo {{#var:BUILD_SCRIPT}} -c bootloader | ||
{{#ifeq: {{#var:HARDWARE_NAME}} | VAR-SOM-MX8X |{{#ifeq: {{#var:MACHINE_NAME_B0}} | imx8qxpb0-var-som | | |||
Or, to build for i.MXQXP SOC revision B0: | |||
$ sudo {{#var:BUILD_SCRIPT_B0}} -c bootloader | |||
|}}|}} | |||
=== Build kernel, dtb files and kernel | {{#ifexpr: {{#var:DEBIAN_VERSION}} >= 12 | ||
| | |||
=== Build Linux kernel packages === | |||
$ cd {{#var:BUILD_FOLDER}} | |||
$ sudo {{#var:BUILD_SCRIPT}} -c kernelpackage | |||
| | |||
=== Build kernel, dtb files, kernel modules, and kernel headers === | |||
$ cd {{#var:BUILD_FOLDER}} | $ cd {{#var:BUILD_FOLDER}} | ||
$ sudo {{#var:BUILD_SCRIPT}} -c kernel | $ sudo {{#var:BUILD_SCRIPT}} -c kernel | ||
$ sudo {{#var:BUILD_SCRIPT}} -c modules | $ sudo {{#var:BUILD_SCRIPT}} -c modules | ||
$ sudo {{#var:BUILD_SCRIPT}} -c kernelheaders | |||
{{#ifeq: {{#var:HARDWARE_NAME}} | VAR-SOM-MX8X |{{#ifeq: {{#var:MACHINE_NAME_B0}} | imx8qxpb0-var-som | | |||
Or, to build kernel, dtb, kernel modules for i.MXQXP SOC revision B0: | |||
$ sudo {{#var:BUILD_SCRIPT_B0}} -c kernel | |||
$ sudo {{#var:BUILD_SCRIPT_B0}} -c modules | |||
$ sudo {{#var:BUILD_SCRIPT_B0}} -c kernelheaders | |||
|}}|}}}} | |||
=== Build rootfs === | === Build rootfs === | ||
Line 63: | Line 114: | ||
$ cd {{#var:BUILD_FOLDER}} | $ cd {{#var:BUILD_FOLDER}} | ||
$ sudo {{#var:BUILD_SCRIPT}} -c rootfs | $ sudo {{#var:BUILD_SCRIPT}} -c rootfs | ||
{{#ifeq: {{#var:HARDWARE_NAME}} | VAR-SOM-MX8X |{{#ifeq: {{#var:MACHINE_NAME_B0}} | imx8qxpb0-var-som | | |||
Or, to build rootfs for i.MXQXP SOC revision B0: | |||
$ sudo {{#var:BUILD_SCRIPT_B0}} -c rootfs | |||
|}}|}} | |||
=== Pack rootfs === | === Pack rootfs === | ||
To create the root file system archive (rootfs.tar.gz){{#ifeq: {{#var:PROVIDE_UBIFS}} | NO || and UBI image (rootfs.ubi.img)}}, run the following commands: | |||
$ cd {{#var:BUILD_FOLDER}} | $ cd {{#var:BUILD_FOLDER}} | ||
$ sudo {{#var:BUILD_SCRIPT}} -c rtar | $ sudo {{#var:BUILD_SCRIPT}} -c rtar | ||
$ sudo {{#var:BUILD_SCRIPT}} -c rubi | {{#ifeq: {{#var:PROVIDE_UBIFS}} | NO ||$ sudo {{#var:BUILD_SCRIPT}} -c rubi}} | ||
{{#ifeq: {{#var:HARDWARE_NAME}} | VAR-SOM-MX8X |{{#ifeq: {{#var:MACHINE_NAME_B0}} | imx8qxpb0-var-som | | |||
Or, to pack rootfs for i.MXQXP SOC revision B0: | |||
$ sudo {{#var:BUILD_SCRIPT_B0}} -c rtar | |||
|}}|}} | |||
{{#ifeq: {{#var:TIGHT_NAND}} | true | | |||
Note: <span style="color:red">The NAND filesystem is console only and may not have all the features as eMMC/SD card</span> <br> | |||
To fit the NAND UBIFS filesystem as per your need, optimize the UBIFS by removing the packages. | |||
|}} | |||
= Create boot SD card = | = Create boot SD card = | ||
Line 78: | Line 142: | ||
$ cd {{#var:BUILD_FOLDER}} | $ cd {{#var:BUILD_FOLDER}} | ||
$ sudo {{#var:BUILD_SCRIPT}} -c sdcard -d /dev/sdX | $ sudo {{#var:BUILD_SCRIPT}} -c sdcard -d /dev/sdX | ||
{{#ifeq: {{#var:HARDWARE_NAME}} | VAR-SOM-MX8X |{{#ifeq: {{#var:MACHINE_NAME_B0}} | imx8qxpb0-var-som | | |||
Or, to build sdcard for i.MXQXP SOC revision B0: | |||
$ sudo {{#var:BUILD_SCRIPT_B0}} -c sdcard -d /dev/sdX | |||
|}}|}} | |||
where '/dev/sdX' path to the block SD device in your system. | where '/dev/sdX' path to the block SD device in your system. | ||
== Create a boot SD card image using a loop device == | |||
It is also possible to use the "{{#var:BUILD_SCRIPT}}" script to create a boot SD card image, while using a loop device instead of attaching a real SD card.<br> | |||
<br> | |||
Create an empty file using the following command: | |||
$ dd if=/dev/zero of={{#var:MACHINE_NAME}}-debian-sd.img bs=1M count=3720 | |||
The above command creates a 3700MiB file representing the SD card.<br> | |||
<br> | |||
Attach the first available loop device to this file: | |||
$ sudo losetup -Pf {{#var:MACHINE_NAME}}-debian-sd.img | |||
To find the actual loop device being used, run: | |||
$ losetup -a | grep {{#var:MACHINE_NAME}}-debian-sd.img | |||
Write the content to the loop device to generate the SD card image: | |||
$ sudo {{#var:BUILD_SCRIPT}} -c sdcard -d /dev/loopX | |||
(Replace /dev/loopX with your actual loop device, e.g. /dev/loop0)<br><br> | |||
Detach the loop device from the file: | |||
$ sudo losetup -d /dev/loopX | |||
To compress the SD card image file use the following command: | |||
$ gzip -9 {{#var:MACHINE_NAME}}-debian-sd.img | |||
To write the SD card image to a real SD card device use the following command: | |||
$ zcat {{#var:MACHINE_NAME}}-debian-sd.img.gz | sudo dd of=/dev/sdX bs=1M && sync | |||
(Replace /dev/sdX with your actual SD device, e.g. /dev/sdb) | |||
= Boot the board with a bootable SD card = | = Boot the board with a bootable SD card = | ||
{{#ifeq: {{#var:HARDWARE_NAME}} | DART-6UL | | {{#ifeq: {{#var:HARDWARE_NAME}} | DART-6UL | | ||
<span style="color:red"> | Note: <span style="color:red">The WiFi is not operational when booting from SD card</span>, as the WiFi and SD card are using the same SDIO interface.<br> | ||
A typical use-case is to boot from an SD card, flash the eMMC/NAND flash, and re-boot from the eMMC/NAND flash to have the WiFi operational. | |||
A typical use-case | |}} | ||
{{#ifeq: {{#var:HARDWARE_NAME}} | DART-MX8M | | |||
Note: <span style="color:red">The WiFi is not operational when booting from SD card</span>, as the WiFi and SD card are using the same SDIO interface.<br> | |||
A typical use-case is to boot from an SD card, flash the eMMC, and re-boot from the eMMC to have the WiFi operational. | |||
|}} | |}} | ||
== Setting the Boot Mode == | == Setting the Boot Mode == | ||
{{#lst:Yocto_Platform_Customization|{{#var:DEBIAN_BOOT_BOARD_SECTION}}}} | {{#lst:Yocto_Platform_Customization|{{#var:DEBIAN_BOOT_BOARD_SECTION}}}} | ||
== Automatic device | == {{#ifeq: {{#var:SUPPORT_UBOOT_AUTO_DTB}} | NO | Device| Automatic device}} tree selection in U-Boot == | ||
{{#ifeq: {{#var:SUPPORT_UBOOT_AUTO_DTB}} | NO | | |||
As shown in the [[#Build_Results| Build Results]] table above, we have different kernel device trees, corresponding to our different H/W configurations (sometimes they are renamed without the "{{#var:KERNEL_IMAGE}}-" prefix). | |||
In U-Boot, set the device tree file manually: | |||
| | |||
{{#ifeq: {{#var:HARDWARE_NAME}} | DART-6UL | | {{#ifeq: {{#var:HARDWARE_NAME}} | DART-6UL | | ||
{{#lst:Yocto_Platform_Customization|DART-6UL_U-BOOT_DT_SELECTION}} | {{#lst:Yocto_Platform_Customization|DART-6UL_U-BOOT_DT_SELECTION}} | ||
Line 99: | Line 203: | ||
We implemented a script in U-Boot's environment, which sets the fdt_file environment variable based on the detected hardware. | We implemented a script in U-Boot's environment, which sets the fdt_file environment variable based on the detected hardware. | ||
}} | }} | ||
=== Enable/Disable Automatic Device Tree selection === | === Enable/Disable Automatic Device Tree selection === | ||
To enable the automatic device tree selection in U-Boot (already enabled by default): | To enable the automatic device tree selection in U-Boot (already enabled by default): | ||
$ setenv fdt_file | $ setenv fdt_file undefined | ||
$ saveenv | $ saveenv | ||
To disable the automatic device tree selection in U-Boot, set the device tree file manually: | To disable the automatic device tree selection in U-Boot, set the device tree file manually:}} | ||
$ setenv fdt_file | $ setenv fdt_file YOUR_DTB_FILE | ||
$ saveenv | $ saveenv | ||
<!-- Make NOTE for DART-6UL only --> | <!-- Make NOTE for DART-6UL only --> | ||
{{#ifeq: {{#var:HARDWARE_NAME}} | DART-6UL | | {{#ifeq: {{#var:HARDWARE_NAME}} | DART-6UL | | ||
{{note|Make sure you don't set | {{note|Comment:<br>Make sure you don't set an inappropriate dtb file, like a dtb with nand on a SOM that has eMMC, or a dtb for mx6ull on a SOM with an mx6ul SOC.|info}} | ||
|}} | |}} | ||
Line 133: | Line 238: | ||
| local user | | local user | ||
|- | |- | ||
| | | x_user | ||
| | | | ||
| used for X session access | | used for X session access | ||
|- | |- | ||
|} | |} | ||
{{#ifeq: {{#var:SUPPORT_X11}} | NO | Please note: Vivante libraies for this release '''do not support X11''', only '''weston''' backend is provided |}} | |||
= Flash images to NAND | = Flash images to {{#ifeq: {{#var:PROVIDE_UBIFS}} | NO || NAND / }} eMMC = | ||
{{#ifeq: {{#var: | {{#ifeq: {{#var:PROVIDE_UBIFS}} | NO | | ||
To install Debian to the on-SOM eMMC, run the following command '''as root''': | To install Debian to the on-SOM eMMC, run the following command '''as root''': | ||
{{#ifeq: {{#var:HARDWARE_NAME}} | VAR-SOM-MX6 | | |||
<pre> | <pre> | ||
# debian-install.sh -b <mx6cb|scb|dart> -t <cap|res> | # debian-install.sh -b <mx6cb|scb|dart> -t <cap|res> | ||
</pre> | </pre> | ||
where the "-b" option provide the carrier board used (MX6CustomBoard/SOLOCustomBoard/DART-MX6) and the "-t" option provide the touch type when using MX6CustomBoard (ignored otherwise). | where the "-b" option provide the carrier board used (MX6CustomBoard/SOLOCustomBoard/DART-MX6) and the "-t" option provide the touch type when using MX6CustomBoard (ignored otherwise). | ||
| | |||
{{#ifeq: {{#var:HARDWARE_NAME}} | VAR-SOM-MX8 | | |||
<pre> | |||
# install_debian.sh -d <lvds|hdmi|dp> | |||
</pre> | |||
where the "-d" option set display type, default is lvds. | |||
| | |||
{{#ifeq: {{#var:HARDWARE_NAME}} | DART-MX8M | | |||
<pre> | |||
# install_debian.sh -d <lvds|hdmi|dp|dual-display> | |||
</pre> | |||
where the "-d" option set display type, default is lvds. | |||
| | |||
<pre> | |||
# install_debian.sh | |||
</pre> | |||
}} | |||
}} | |||
}} | |||
The above script is located in /usr/sbin in the rootfs of the SD card used to boot Debian. | The above script is located in /usr/sbin in the rootfs of the SD card used to boot Debian. | ||
| | | | ||
In case you are using a SOM with NAND flash, run the following command '''as root''' to install Debian on it: | In case you are using a SOM with NAND flash, run the following command '''as root''' to install Debian on it: | ||
{{#ifeq: {{#var:DEBIAN_INSTALL_SCRIPT}} | unified | | |||
<pre> | |||
# install_debian.sh -r nand (Follow instructions) | |||
</pre> | |||
| | |||
<pre> | |||
# debian-nand.sh | |||
</pre> | |||
}} | |||
In case you are using a SOM with eMMC, run the following command '''as root''' to install Debian on it: | In case you are using a SOM with eMMC, run the following command '''as root''' to install Debian on it: | ||
{{#ifeq: {{#var:DEBIAN_INSTALL_SCRIPT}} | unified | | |||
<pre> | |||
# install_debian.sh -r emmc (Follow instructions) | |||
</pre> | |||
| | |||
<pre> | |||
# debian-emmc.sh | |||
</pre> | |||
}} | |||
The above scripts are located in /usr/sbin in the rootfs of the SD card used to boot Debian. | 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 = | |||
= How-to: Test and use an | |||
Please see this section in the {{Varlink|{{#var:HARDWARE_NAME}} Yocto|{{#var:YOCTO_RELEASE_LINK}}|Yocto developer guide page}}. It is the same for Debian. | Please see this section in the {{Varlink|{{#var:HARDWARE_NAME}} Yocto|{{#var:YOCTO_RELEASE_LINK}}|Yocto developer guide page}}. It is the same for Debian. | ||
= How-to: Modify kernel configuration = | = How-to: Modify the kernel configuration = | ||
To modify kernel configuration (add/remove features and drivers) please follow the steps below: | To modify the kernel configuration (add/remove features and drivers) please follow the steps below: | ||
1. cd {{#var:BUILD_FOLDER}}/src/kernel | 1. $ cd {{#var:BUILD_FOLDER}}/src/kernel | ||
2. | 2. $ sudo make ARCH={{#var:ARCH}} mrproper | ||
3. | 3. $ sudo make ARCH={{#var:ARCH}} {{#var:KERNEL_DEFCONFIG}} | ||
4. | 4. $ sudo make ARCH={{#var:ARCH}} menuconfig | ||
5. Navigate the menu and select the desired kernel functionality | 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?" | 6. Exit the menu and answer "Yes" when asked "Do you wish to save your new configuration?" | ||
7. | 7. $ sudo make ARCH={{#var:ARCH}} savedefconfig | ||
8. | 8. $ sudo cp arch/{{#var:ARCH}}/configs/{{#var:KERNEL_DEFCONFIG}} arch/{{#var:ARCH}}/configs/{{#var:KERNEL_DEFCONFIG}}.orig | ||
9. | 9. $ sudo cp defconfig arch/{{#var:ARCH}}/configs/{{#var:KERNEL_DEFCONFIG}} | ||
10. Follow the instructions above to rebuild kernel and modules, repack rootfs images and recreate SD card | 10. Follow the instructions above to rebuild kernel and modules, repack rootfs images and recreate SD card | ||
{{#ifexpr: {{#var:DEBIAN_VERSION}} >= 10 | | |||
= How-to: Build and install a custom device tree = | |||
To build and install a custom device tree, add the filename to G_LINUX_DTB in https://github.com/varigit/debian-var/blob/{{#var:DEBIAN_BRANCH}}/variscite/{{#var:MACHINE_NAME}}/{{#var:MACHINE_NAME}}.sh}} | |||
{{#ifeq: {{#var:SOC_SERIES}} | imx8 | | |||
= Upgrading Debian Packages = | |||
To update the packages either at runtime or build time, refer to {{Varlink|IMX8_Debian_Package_Update|{{#var:RELEASE_LINK}}|Upgrading Debian Packages}} | |||
|}} | |||
= Build a sample C "Hello, world!" program = | |||
Create a file called myhello.c with the following content: | |||
<pre> | |||
#include <stdio.h> | |||
int main() { | |||
printf("Hello, World!\n"); | |||
return 0; | |||
} | |||
</pre> | |||
Export the C (cross-)compiler path: | |||
$ export CC={{#var:BUILD_FOLDER}}/toolchain/{{#var:TOOLCHAIN}}/bin/{{#var:CROSS_COMPILE}}gcc | |||
Compile: | |||
$ $CC myhello.c -o myhello | |||
Now you should have an app called myhello, that can be run on your target board.<br> | |||
You can add it to your rootfs image or copy it directly to the rootfs on the board (using scp, for example). | |||
{{#ifeq: {{#var:LIBC_WORKAROUND}} | true | | |||
= Installing packages which depend on libc = | |||
NXP Provides the Vivante GPU driver in binary form and it requires a specific minimum version of libc.<br> | |||
Due to this requirement from the GPU user space libraries, this Debian release uses an updated version of libc from the newer Debian Bullseye repository.<br> | |||
Therefore, if you need to install packages which depend on libc (like build-essentials, gcc, libc6-dev, etc.) please use their "testing" version (from Debian Bullseye).<br> | |||
For example: | |||
apt-get update | |||
apt-get install build-essential/testing gcc/testing g++/testing libc6-dev/testing | |||
| | |||
}} | |||
{{#ifeq: {{#var:SUPPORT_X11}} | NO | | |||
= 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<br> | |||
refer to {{Varlink|IMX8_Debian_XWayland|{{#var:RELEASE_LINK}}|XWayland Example}} | |||
| | |||
}} | |||
{{#ifeq: {{#var:TI_RELEASE}} | 09.02.01.10 | | |||
<!-- Set release according to "release" parameter in URL and use am62-debian-bookworm-6.1.83_09.02.01.10-v1.0 as default | |||
--> {{INIT_RELEASE_PARAM|am62-debian-bookworm-6.1.83_09.02.01.10-v1.0}}<!-- | |||
--> {{#lst:Debian_Platform_Customization|{{#var:RELEASE_PARAM}}}} <!-- | |||
--> {{SoftwareEx | |||
|title={{#var:HARDWARE_NAME}} Debian {{#var:DEBIAN_NAME}} {{#var:DEBIAN_VERSION}} | |||
|image=Debian.png | |||
|description=Debian project is a Linux distributions for embedded devices. Debian big varities of pre-built packages | |||
and easy to customization provides rapid prototyping with minimal efforts. | |||
This release is based on TI's [{{#var:TI_RELEASE_NOTES}} {{#var:TI_RELEASE}}] Release. Variscite extends TI's release to support its VAR-SOM-AM62 System On Module. | |||
Release version: '''{{#var:RELEASE_NAME}}''' | |||
|category1=VAR-SOM-AM62 | |||
|category2=Yocto | |||
|documentation= | |||
{{OS_Overview_General_Column}}<!-- | |||
-->{{OS_Overview_Build_Column_AM62}}<!-- | |||
-->{{OS_Overview_HowTo_Column_AM62}}}} | |||
{{NONUMBEREDHEADINGS}} | |||
}} |
Latest revision as of 18:11, 20 November 2024
This page is using the default release RELEASE_STRETCH_V3.0_DART-6UL.
To view this page for a specific Variscite SoM and software release, please follow these steps:
- Visit variwiki.com
- Select your SoM
- Select the software release
Overview
This page describes how to build and install Debian distribution (Stretch) on Variscite boards with DART-6UL.
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
These instructions were tested on Ubuntu 16.04/18.04 x64 host PCs. When using other distributions, there may be issues.
To learn more, please see Variscite's Docker Build Environment guide.
Windows with WSL/WSL2 is not supported for developmentInstalling 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 libssl-dev gawk wget \ git-core diffstat unzip texinfo gcc-multilib build-essential chrpath socat libsdl1.2-dev \ autoconf libtool libglib2.0-dev libarchive-dev xterm sed cvs subversion \ kmod coreutils texi2html bc docbook-utils 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 cmake zstd udisks2 libgnutls28-dev \ python-pysqlite2 python-git python-m2crypto python-pyelftools
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
Build kernel, dtb files, kernel modules, and kernel headers
$ cd ~/var_mx6ul_dart_debian $ sudo ./make_var_mx6ul_dart_debian.sh -c kernel $ sudo ./make_var_mx6ul_dart_debian.sh -c modules $ sudo ./make_var_mx6ul_dart_debian.sh -c kernelheaders
Build rootfs
Internet connection should be available
$ cd ~/var_mx6ul_dart_debian $ sudo ./make_var_mx6ul_dart_debian.sh -c rootfs
Pack rootfs
To create the root file system archive (rootfs.tar.gz) and UBI image (rootfs.ubi.img), run the following commands:
$ cd ~/var_mx6ul_dart_debian $ sudo ./make_var_mx6ul_dart_debian.sh -c rtar $ sudo ./make_var_mx6ul_dart_debian.sh -c rubi
Create boot SD card
- Follow the above steps for make rootfs, kernel, bootloader;
- Insert the SD card to card reader connected to a host system;
- Run the following commands (Caution! All data on the card will be destroyed):
$ cd ~/var_mx6ul_dart_debian $ sudo ./make_var_mx6ul_dart_debian.sh -c sdcard -d /dev/sdX
where '/dev/sdX' path to the block SD device in your system.
Create a boot SD card image using a loop device
It is also possible to use the "./make_var_mx6ul_dart_debian.sh" script to create a boot SD card image, while using a loop device instead of attaching a real SD card.
Create an empty file using the following command:
$ dd if=/dev/zero of=imx6ul-var-dart-debian-sd.img bs=1M count=3720
The above command creates a 3700MiB file representing the SD card.
Attach the first available loop device to this file:
$ sudo losetup -Pf imx6ul-var-dart-debian-sd.img
To find the actual loop device being used, run:
$ losetup -a | grep imx6ul-var-dart-debian-sd.img
Write the content to the loop device to generate the SD card image:
$ sudo ./make_var_mx6ul_dart_debian.sh -c sdcard -d /dev/loopX
(Replace /dev/loopX with your actual loop device, e.g. /dev/loop0)
Detach the loop device from the file:
$ sudo losetup -d /dev/loopX
To compress the SD card image file use the following command:
$ gzip -9 imx6ul-var-dart-debian-sd.img
To write the SD card image to a real SD card device use the following command:
$ zcat imx6ul-var-dart-debian-sd.img.gz | sudo dd of=/dev/sdX bs=1M && sync
(Replace /dev/sdX with your actual SD device, e.g. /dev/sdb)
Boot the board with a bootable SD card
Note: The WiFi is not operational when booting from SD card, as the WiFi and SD card are using the same SDIO interface.
A typical use-case is to boot from an SD card, flash the eMMC/NAND flash, and re-boot from the eMMC/NAND flash to have the WiFi operational.
Setting the Boot Mode
Booting your system from an SD card requires switching the Boot DIP switches. See picture below.
On the VAR-6ULCustomBoard (with a DART-6UL):
- "00" The current position in the picture will set the system to boot from SD card
- "01" Moving the right switch will set the system to boot from eMMC
- "10" Moving the left switch will set the system to boot from NAND flash
- "11" is illegal.
On the Concerto-Board (with a VAR-SOM-6UL):
- ON-EXT: Boot from the external storage (SD card) - the current position in the picture
- OFF-INT: Boot from the SOM's internal storage (eMMC/NAND flash)
Automatic device tree selection in U-Boot
Enable/Disable Automatic Device Tree selection
To enable the automatic device tree selection in U-Boot (already enabled by default):
$ setenv fdt_file undefined $ saveenv
To disable the automatic device tree selection in U-Boot, set the device tree file manually:
$ setenv fdt_file YOUR_DTB_FILE $ saveenv
Make sure you don't set an inappropriate dtb file, like a dtb with nand on a SOM that has eMMC, or a dtb for mx6ull on a SOM with an mx6ul SOC.
Build Results
The resulted images are located in ~/var_mx6ul_dart_debian/output/.
Image name |
How to use |
---|---|
rootfs.tar.gz | Root filesystem tarball used for installation on SD card and eMMC |
rootfs.ubi.img | Use for flash to NAND |
zImage | Linux kernel image |
SPL.nand | SPL built for NAND. The SPL is pre-U-Boot SW component, required for DDR initialization |
SPL.mmc | SPL built for SD card and eMMC boot. The SPL is pre-U-Boot SW component, required for DDR initialization |
u-boot.img.nand | U-Boot built for NAND flash |
u-boot.img.mmc | U-Boot built for SD card or eMMC |
Device Tree name |
Details |
imx6ull-var-dart-6ulcustomboard-emmc-sd-card.dtb | Device tree blob for DART-6UL with i.MX6ULL SOC, eMMC & SD card enabled. (NAND flash & WiFi disabled) |
imx6ull-var-dart-6ulcustomboard-emmc-wifi.dtb | Device tree blob for DART-6UL with i.MX6ULL SOC, eMMC & WiFi enabled. (NAND flash & SD card disabled) |
imx6ull-var-dart-6ulcustomboard-nand-sd-card.dtb | Device tree blob for DART-6UL with i.MX6ULL SOC, NAND flash & SD card enabled. (eMMC & WiFi disabled) |
imx6ull-var-dart-6ulcustomboard-nand-wifi.dtb | Device tree blob for DART-6UL with i.MX6ULL SOC, NAND flash & WiFi enabled. (eMMC & SD card disabled) |
imx6ul-var-dart-6ulcustomboard-emmc-sd-card.dtb | Device tree blob for DART-6UL with i.MX6UL SOC, eMMC & SD card enabled. (NAND flash & WiFi disabled) |
imx6ul-var-dart-6ulcustomboard-emmc-wifi.dtb | Device tree blob for DART-6UL with i.MX6UL SOC, eMMC & WiFi enabled. (NAND flash & SD card disabled) |
imx6ul-var-dart-6ulcustomboard-nand-sd-card.dtb | Device tree blob for DART-6UL with i.MX6UL SOC, NAND flash & SD card enabled. (eMMC & WiFi disabled) |
imx6ul-var-dart-6ulcustomboard-nand-wifi.dtb | Device tree blob for DART-6UL with i.MX6UL SOC, NAND flash & WiFi enabled. (eMMC & SD card disabled) |
imx6ulz-var-dart-6ulcustomboard-emmc-sd-card.dtb | Device tree blob for DART-6UL with i.MX6ULZ SOC, eMMC & SD card enabled. (NAND flash & WiFi disabled) |
imx6ulz-var-dart-6ulcustomboard-emmc-wifi.dtb | Device tree blob for DART-6UL with i.MX6ULZ SOC, eMMC & WiFi enabled. (NAND flash & SD card disabled) |
imx6ulz-var-dart-6ulcustomboard-nand-sd-card.dtb | Device tree blob for DART-6UL with i.MX6ULZ SOC, NAND flash & SD card enabled. (eMMC & WiFi disabled) |
imx6ulz-var-dart-6ulcustomboard-nand-wifi.dtb | Device tree blob for DART-6UL with i.MX6ULZ SOC, NAND flash & WiFi enabled. (eMMC & SD card disabled) |
imx6ull-var-som-concerto-board-emmc-sd-card.dtb | Device tree blob for VAR-SOM-6UL with i.MX6ULL SOC, eMMC & SD card enabled. (NAND flash & WiFi disabled) |
imx6ull-var-som-concerto-board-emmc-wifi.dtb | Device tree blob for VAR-SOM-6UL with i.MX6ULL SOC, eMMC & WiFi enabled. (NAND flash & SD card disabled) |
imx6ull-var-som-concerto-board-nand-sd-card.dtb | Device tree blob for VAR-SOM-6UL with i.MX6ULL SOC, NAND flash & SD card enabled. (eMMC & WiFi disabled) |
imx6ull-var-som-concerto-board-nand-wifi.dtb | Device tree blob for VAR-SOM-6UL with i.MX6ULL SOC, NAND flash & WiFi enabled. (eMMC & SD card disabled) |
imx6ul-var-som-concerto-board-emmc-sd-card.dtb | Device tree blob for VAR-SOM-6UL with i.MX6UL SOC, eMMC & SD card enabled. (NAND flash & WiFi disabled) |
imx6ul-var-som-concerto-board-emmc-wifi.dtb | Device tree blob for VAR-SOM-6UL with i.MX6UL SOC, eMMC & WiFi enabled. (NAND flash & SD card disabled) |
imx6ul-var-som-concerto-board-nand-sd-card.dtb | Device tree blob for VAR-SOM-6UL with i.MX6UL SOC, NAND flash & SD card enabled. (eMMC & WiFi disabled) |
imx6ul-var-som-concerto-board-nand-wifi.dtb | Device tree blob for VAR-SOM-6UL with i.MX6UL SOC, NAND flash & WiFi enabled. (eMMC & SD card disabled) |
imx6ulz-var-som-concerto-board-emmc-sd-card.dtb | Device tree blob for VAR-SOM-6UL with i.MX6ULZ SOC, eMMC & SD card enabled. (NAND flash & WiFi disabled) |
imx6ulz-var-som-concerto-board-emmc-wifi.dtb | Device tree blob for VAR-SOM-6UL with i.MX6ULZ SOC, eMMC & WiFi enabled. (NAND flash & SD card disabled) |
imx6ulz-var-som-concerto-board-nand-sd-card.dtb | Device tree blob for VAR-SOM-6UL with i.MX6ULZ SOC, NAND flash & SD card enabled. (eMMC & WiFi disabled) |
imx6ulz-var-som-concerto-board-nand-wifi.dtb | Device tree blob for VAR-SOM-6UL with i.MX6ULZ SOC, NAND flash & WiFi enabled. (eMMC & SD card disabled) |
Linux console access
User name | User password | User descriptor |
---|---|---|
root | root | system administrator |
user | user | local user |
x_user | used for X session access |
Flash images to NAND / eMMC
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).