Quantcast
Channel: Boundary Devices
Viewing all 391 articles
Browse latest View live

New Silex WiFi 802.11ac and BT4.1 module

$
0
0

We are glad to release a new BT & WiFi module based on Qualcomm-Atheros QCA9377-3 chip which supports the latest connectivity standards:

  • 802.11b/g/n: 2.412 – 2.472GHz
  • 802.11a/n/ac: 5.180 – 5.825 GHz
  • Bluetooth 4.1 + HS: 2.402 – 2.480 GHz

This allows to achieve great performances, high transfer rates and more reliable connection in environment polluted with 2.4GHz connections.

Here are some iPerf results:

  • TCP: ~160Mbps
  • UDP: ~220Mbps

You can already find this module on our latest Nitrogen7 platform. This module has the same form-factor as our previous modules and is also FCC-compliant so let us know if you want it on another design.

802.11 ac + BT4.1 for i.MX6 and i.MX7 Single Board Computers

802.11 ac + BT4.1 for i.MX6 and i.MX7 Single Board Computers

For more details on the module capabilities, please visit the product page:

Linux Software support

WiFi Components

Device driver

The Linux driver comes from CodeAurora but has been cloned to our own GitHub repository:

Since its source code is pretty big, we decided to keep it as a module and not integrate it into our base kernel tree. Also, the base driver is meant for 3.10 kernels so it needed to be updated in order to be supported by our recent kernels.

The above driver has been tested against our 3.14.52 and 4.1.15 kernels.

If you want to build this module manually, below are the instructions, assuming that:

  • gcc-arm-linux-gnueabihf toolchain is installed on your system (available for Debian/Ubuntu)
  • The kernel source tree you want to build against is located under <kernel_path>
  • The rootfs you want to install to is located under <rootfs_path>
~$ git clone https://github.com/boundarydevices/qcacld-2.0 \
   -b boundary-LNX.LEH.4.2.2.2-4.5.20.034
~$ cd qcacld-2.0/
~/qcacld-2.0$ export ARCH=arm
~/qcacld-2.0$ export CROSS_COMPILE=arm-linux-gnueabihf-
~/qcacld-2.0$ KERNEL_SRC=<kernel_path> CONFIG_CLD_HL_SDIO_CORE=y make
~/qcacld-2.0$ KERNEL_SRC=<kernel_path> INSTALL_MOD_PATH=<rootfs_path> make modules_install

That’s it, now the wlan.ko file should be located under your target rootfs, with all the modules dependencies updated.

Firmware files

Once the driver is built and ready to go, you need to make sure to copy the firmware files to your target rootfs. Otherwise the driver will fail loading the firmware to the chip and therefore no wlan interface will show up.

Since this WiFi/BT combo just got released publicly, the licensing of the firmware files doesn’t allow us to host those files to a public git repository. So just like the NXP proprietary binaries in our Android releases, this repository is hosted in our linode server which requires every client to send its SSH key before having the access granted.

Once the key has been sent, you should receive a confirmation e-mail saying it has been properly added to our server. Then you can freely access our linode repositories and install the firmware files.

~$ git clone git@linode.boundarydevices.com:qca-firmware.git
~$ cd qca-firmware
~/qca-firmware$ DESTDIR=<rootfs_path> make install

User-space programs

The driver runs fine with standard wpa_supplicant and hostapd, no modification required here.

Bluetooth components

Device driver

The BT part of the QCA9377-3 is fully compliant with the HCI H4 protocol over UART so no further driver is required, support is already present in all our kernels.

Firmware files

The BT firmware files are part of the same repository as the WiFi one, see previous section.

User-space programs

This is where it gets more complicated for Bluetooth support for QCA9377-3. Indeed some patches need to be applied to BlueZ5 in order to support the chip.

The reason is that it has its own way of loading the firmware which isn’t part of upstream BlueZ5. Once again, a CodeAurora repository gives the necessary mechanism:

You can see the generated patch in our Yocto layer:

OS integration

Ubuntu/Debian

It is pretty easy, all the work has been done for you, just need to install the Silex packages:

$ sudo apt update
$ sudo apt upgrade
$ sudo apt install qcacld-module qca-firmware

The upgrade takes care of updating the BlueZ5 package so it contains the necessary hciattach modifications to load the firmware.

Then the two QCA packages are in charges of installing all the firmware files and the WiFi driver.

Yocto

Since the firmware files are not publicly available, the recipes are located in our meta-boundary:

In your local.conf file, add the following lines in order to add Silex support to your image:

IMAGE_INSTALL_append = \
    " kernel-module-silex \
      linux-firmware-silex \
      bluez5 "

Android

Support has been added to our Nitrogen6x Android device for our Marshmallow release.

If you want to build Android for this module, first refer to our Android Getting Started Guide but issue the following command before building the image:

~/myandroid$ sed -i 's/TI/QCA/' device/boundary/nitrogen6x/wifi_config.mk

The post New Silex WiFi 802.11ac and BT4.1 module appeared first on Boundary Devices.


Using SWUpdate to upgrade your system

$
0
0

Updating an Embedded System, whether it is locally with a USB drive or over-the-air (OTA), is a complex matter. Unfortunately there is no one size-fits-all solution although several options exist. This blog post will focus on SWUpdate which can be considered an update framework here to ease your life.

This article will be far from exhaustive, it will give pointers to how we think this framework can help you create the perfect update system. This solution has been created by Stefano Babic from Denx, it is now getting many contributors.

Overview

As the documentation says: Embedded Systems become more and more complex, and their software reflects the augmented complexity. New features and fixes make it more desirable than ever that the software on an embedded system can be updated in an absolutely reliable way.

How are Embedded Systems different than a regular PC with regard to updates? Well as part of the reliability concern raised above, it needs to be power-safe! This means that if the power is cut at any time during the update process, the device should always be able to boot. This is not the case with package-based updates which is why embedded customers often chose an atomic update.

This atomic update can either be made from the bootloader or from user-space. The SWUpdate project decided to use the latter option because updating from bootloader isn’t as flexible in terms of support (missing drivers/capabilities). In other words, this article will explain how the following components can be updated atomically:

  • Kernel
  • Device tree
  • Root file-system

The bootloader isn’t part of it for the simple reason that in our platforms there’s no redundant bootloader copy in NOR (not supported by the BootROM). So updating U-Boot isn’t recommended since a power cycle during the NOR programming can brick the device.

The SWUpdate framework brings the following features:

  • A standard update image format (.swu file)
  • OTA update capabilities:
    • Exposing a web interface to access the board
    • Daemon connecting to HawkBit server
  • Local update:
    • Update from any file in file-system
  • A standard parser supporting many handlers:
    • Partitions (UBI volumes)
    • Images to be installed; can be compressed
    • Files; copied instead of images
    • Scripts; shell or LUA, called pre/post install
    • U-Boot; to update env variables
  • Custom handlers API
    • Allows to extend the support to new protocols/images
  • Update images from verified source
    • Update images can be signed
  • One image for all: can target several platforms
    • Each component can be tied to a specific hw/sw version

How does it work?

At this point you are probably asking a lot of questions about how this whole thing works, this section will answer the questions we asked ourselves.

What are the different update schemes?

There are two main different approaches to update the system from user-space.

Double copy with fall-back

If there is enough space on the storage to save two copies of the whole software, it is possible to guarantee that there is always a working copy even if the software update is interrupted or a power off occurs.

Each copy must contain the kernel, the root file system, and each further component that can be updated. There also needs to be a mechanism to identify which version is running.

SWUpdate should be inserted in the application software, and the application software will trigger it when an update is required. The duty of SWUpdate is to update the stand-by copy, leaving the running copy of the software untouched.

A synergy with the boot loader is often necessary, because the boot loader must decide which copy should be started. Again, it must be possible to switch between the two copies. After a reboot, the boot loader decides which copy should run.

Double Copy Layout

Double Copy Layout

Single copy – running as standalone image

The software upgrade application consists of kernel and a small root file system, with the application and its libraries. The whole size is much less than a single copy of the system software. The system can be put in “upgrade” mode, simply signaling to the boot loader that the upgrading software must be started. There are several ways to communicate with the boot loader but the most common one is to set some variables in the boot loader environment (stored in NOR in our platforms).

The boot loader starts “SWUpdate”, booting the SWUpdate kernel and the initrd image as root file system. Because it runs in RAM, it is possible to upgrade the whole storage. Unlike the double-copy strategy, the systems must reboot to put itself in update mode.

This concept consumes less space in storage as having two copies, but it does not guarantee a fall-back without updating again the software. However, it can be guaranteed that the system goes automatically in upgrade mode when the productivity software is not found or corrupted, as well as when the upgrade process is interrupted for some reason.

Single Copy Layout

Single Copy Layout

Note that is it the same mechanism as used by Android (and its recovery system).

What does an update image look like?

The main concept is that the manufacturer delivers a single big image. All single images are packed together (cpio was chosen for its simplicity and because can be streamed) together with an additional file (sw-description), that contains meta information about each single image.

The format of sw-description can be customized: SWUpdate can be configured to use its internal parser (based on libconfig), or calling an external parser in LUA.

SWU image format

SWU image format

The sw-description file, as its name suggests, describe all the components present in the image. Here is a sample that includes a rootfs for Nitrogen6x REV4 as well as a script. 

software =
{
	version = "1.0.1";
	nitrogen6x = {
		hardware-compatibility: [ "REV4" ];
		images: (
			{
				filename = "rootfs.ext2.gz";
				device = "/dev/update";
				type = "raw";
				sha256 = "ac802fd79e821ad0b562379e5e101ad67080986c3749a3fe8bb74230cb90ef3f";
				compressed = true;
			}
		);
		scripts: (
			{
				filename = "update.sh";
				type = "shellscript";
				sha256 = "faaaa3096b01c196d20903e21ec88757834e68f09de4c2edd721ad8b83a9628e";
			 }
		);
	};
}

How does authentication work?

As you can see in the sample above, the first step towards image verification is to have the sha256 sum for each component. Then in order to make sure no one can modify the sw-description you need to sign it. Here are the steps to sign that file:

  • Create the private key
$ openssl genrsa -out swupdate-priv.pem
  • Create the public key
$ openssl rsa -in swupdate-priv.pem -out swupdate-public.pem \
  -outform PEM -pubout
  • Sign the image description file
$ openssl dgst -sha256 -sign swupdate-priv.pem \
  sw-description > sw-description.sig

Once signed, you can ensure that nobody can temper with your update image to include malicious firmware.

If you built the swupdate binary with CONFIG_SIGNED_IMAGE, it is not possible to disable the check at runtime for obvious security reasons.

How can I target a specific hw/sw version?

For hardware targeting, you can enable the CONFIG_HW_COMPATIBILITY option. It will read the current platform hardware version from /etc/hwrevision. This means you update image can target several revisions/platforms at once.

software =
{
	version = "1.0.1";
	target1 = {
		hardware-compatibility: [ "1.0", "1.2", "1.3" ];
		...
	};
	target1 = {
		hardware-compatibility: [ "1.1" ];
		...
	};
	target2 = {
		...
	};
}

Same goes for software, you can add some “name” and “version” fields for each components that will be checked against /etc/sw-versions. This will only be used if your component has the install-if different field set.

What media/method can be used to update?

As stated in the overview, SWUpdate supports both OTA and local updates. We’ll detail some possible implementations here.

Local update: USB drive example

Once the drive is mounted and the update located, you can start swupdate with the -i option.

# swupdate -i <name_of_update>

If you enabled the signed image capability, you also need to provide the public key.

# swupdate -i <name_of_update> -k <path_to_pubkey>

In order to automate this procedure, you can create a udev/mdev rule that executes a script every time a USB driver is plugged.

Finally, it is worth noting that it is useful to add the -v option in order for the tool to give more details on its progress.

OTA update: target as a web server

The tool includes a web server capability thanks to Mongoose. Therefore the CONFIG_MONGOOSE must be enabled via the menuconfig. Then you can start the swupdate tool as follows:

# swupdate -k <path_to_pubkey> -w "-document_root /var/www/swupdate/"

Then you can connect to your board to the port 8080 and see the update interface.

SWUpdate web server

SWUpdate web server

From the interface you can select and apply an update as well as rebooting the target.

OTA update: downloading from HTTP server

SWUpdate also offers to download the update file from an HTTP server with the -d option.

# swupdate -k <path_to_pubkey> -d <url>

OTA update: Suricatta daemon

Finally, the tool offers a daemon named Suricatta which allows to connect to a HawkBit server. HawkBit offers a mechanism and an interface to manage software updates.

Its installation is not trivial so it won’t be covered in this post. If you wish to test this feature, make sure to read the documentation.  But here is a screenshot of what a HawkBit manager looks like.

HawkBit manager

HawkBit manager

On the target, you simply need to pass the server information with the -u option.

# swupdate -k <path_to_pubkey> -u "<hawkbit options>"

How to configure SWUpdate?

Just like many open-source projects, SWUpdate relies on Kconfig so you can browse through the options using menuconfig.

$ make menuconfig
SWUpdate menuconfig

SWUpdate menuconfig

Where can I find more information?

The documentation is very well written, exhaustive, easy to read and understand so we invite everyone to have a look:

Also, as usual, the source code can also shed some lights on some details:

Finally, Stefano made a presentation some time ago presenting the project which you can find here:

What about build systems integration?

The project is getting more and more traction from the community, hence it is present in several build systems already.

Yocto

A meta-swupdate layer is provided. It contains the required changes for mtd-utils and for generating LUA.

The recipes for Yocto are meant for single-copy scheme. Therefore it generates an initrd image containing the SWUpdate application, that is automatically started after mounting the root file system.

In order to generate the udpate initrd:

  • Clone the repository:
~/yocto/sources$ git clone https://github.com/sbabic/meta-swupdate.git
  • Add meta-swupdate to you bblayers.conf
  • Generate the initrd image:
~/yocto/build$ MACHINE=<your machine> bitbake swupdate-image

You will find the result in your tmp/deploy/<your machine> directory. 

If you plan on using a double-copy scheme, the tool needs to be added to your custom image.

Buildroot

Buildroot also includes the swupdate package:

You need select the BR2_PACKAGE_SWUPDATE option to have the package in your image.

Then you can specify the SWUpdate configuration to use via the BR2_PACKAGE_SWUPDATE_CONFIG option. By default it uses the package config.

Also, an interesting feature is that you can configure SWUpdate from your Buildroot build folder with the following command:

~/buildroot$ make swupdate-menuconfig
~/buildroot$ make

This will modify the output/build/swupdate-xxx/.config file locally.

Any image to play with?

We figured the best way for people to fully understand SWUpdate would be to create a demo image.

So here are some very simple images/binaries you can use to get started:

Once booted up, you can check the current software version.

# cat /etc/sw-versions 
rootfs 1.0.0
kernel 4.1.15-g207addb

From there you can try several ways to update the platform:

# mount /dev/sda1 /mnt
# swupdate -i /mnt/nitrogen6x_1.0.1.swu -k /etc/swupdate/swupdate-public.pem
  • Using the target web server
    • Once the target gets an IP, you can access it from your PC
    • http://<target_ip>:8080
  • Download the image directly from our HTTP linode server
# swupdate -k /etc/swupdate/swupdate-public.pem \
  -d http://linode.boundarydevices.com/nitrogen6x_1.0.1.swu

Once the update has been applied, you can see that U-Boot environment has been updated to boot from a different partition.

# fw_printenv bootpart
bootpart=2

The only thing left to do is to reboot using the newly flashed rootfs and check the software version.

# cat /etc/sw-versions 
rootfs 1.0.1
kernel 4.1.15-g207addb

In the overview section, it is said that updating U-Boot isn’t power-safe. However you might wonder about the U-Boot environment which is modified in this example? Well to be honest this example is not completely safe since a power cycle can happen during flash operations.

However note that it can be safe, but U-Boot must be configured correctly. Indeed it supports two copies of the environment to be power-safe during a an environment update. The board’s configuration file must have defined CONFIG_ENV_OFFSET_REDUND.

 

As usual, let us know your thoughts on this article.

The post Using SWUpdate to upgrade your system appeared first on Boundary Devices.

Debugging using Segger J-Link JTAG

$
0
0

JTAG is a useful tool that allows customers additional debugging options.  Segger was kind enough to send us a J-Link Plus probe for us to test.  This blog post will describe how to setup your environment and use the J-Link to debug during both U-Boot and Kernel development.

Note that all of the instructions below would work for all other J-Link probes.

Environment setup

Basic software setup

This blog post will focus on Linux installation but Windows setup should be very similar.

First, you need to install the J-Link tools from Segger website:

From there you need to download the J-Link Software and Documentation Pack for your OS.

The version v6.10m was used for this blog post, which is the latest version at the time of this writing.

If you use an Ubuntu/Debian distro, the installation is very simple:

$ sudo dpkg -i JLink_Linux_V610m_x86_64.deb

Once installed, several tools and documentation will be installed, here are the important ones:

  • UM08001_JLink.pdf: User Manual (located under /opt/SEGGER/JLink_V610m/Doc/)
  • JLinkExe: J-Link Commander tool that can be used for
    • verifying proper installation of the USB driver
    • verifying the connection to the target CPU
    • updating the firmware (automatically)
  • JLinkGDBServer: GDB remote server
    • for GDB to connect to and communicate with the target

The latter tool is the most important since it will be used for every GDB debugging session. In our case, we want to use debug on ARM targets, so we need a cross ARM toolchain and GDB.

For Ubuntu/Debian, you can simply install the following packages:

$ sudo apt-get install gcc-arm-linux-gnueabihf gdb-multiarch

Another solution is to use a toolchain from Linaro which includes the cross GDB binary:

The tools above are sufficient to start debugging using GDB manually.

Graphical IDE setup

If you wish to use a graphical IDE instead of entering GDB commands manually, there are some open-source solutions.

For this blog post, we chose the most commonly used IDE: Eclipse. Although it was primarly made for Java developement, it now exists in different flavors.

The version we are interested for U-Boot/Kernel development is the C/C++ one:

Once the tarball downloaded, you can extract to the folder of your choice.

$ tar xzf ~/Downloads/eclipse-cpp-neon-1a-linux-gtk-x86_64.tar.gz
$ ./eclipse/eclipse 

You then need to install the GNU ARM Eclipse plug-in which contains J-Link debugging features. The plugin website explains the installation procedure in details:

Make sure to select J-Link Debugging when installing the plugin.

ARM Plugin Install

ARM Plugin Install

The J-Link part of the plugin is also well explained here.

Hardware setup

As you might have noticed, our boards have a tiny JTAG connector which is (much) smaller than the standard 20-pin connector.

In order to connect the J-Link probe you threrefore need the following adaptation board:

This board comes with several jumpers. Make sure to place them on J3, J4 and J6 so the JTAG can properly communicate with the CPU.

Also, make sure that the pin 1 (white dot) of the adaptation board matches the pin 1 of the board connector.

Here is what it should look like for the BD-SL-iMX6.

BDSL + J-Link

BDSL + J-Link

At this point, if the board is powered, the JLinkExe tool should detect a CPU is connected.

$ JLinkExe -device MCIMX6Q6 -if JTAG -speed 1000 -JTAGConf -1,-1
SEGGER J-Link Commander V6.10m (Compiled Nov 10 2016 18:38:45)
DLL version V6.10m, compiled Nov 10 2016 18:38:36
Connecting to J-Link via USB...O.K.
Firmware: J-Link V10 compiled Sep  1 2016 18:29:58
Hardware version: V10.10
S/N: 600102841
License(s): RDI, FlashBP, FlashDL, JFlash, GDB
VTref = 3.251V

Type "connect" to establish a target connection, '?' for help
J-Link>connect
Device "MCIMX6Q6" selected.
...
Debug architecture ARMv7.0
Data endian: little
Main ID register: 0x412FC09A
I-Cache L1: 32 KB, 256 Sets, 32 Bytes/Line, 4-Way
D-Cache L1: 32 KB, 256 Sets, 32 Bytes/Line, 4-Way
System control register:
  Instruction endian: little
  Level-1 instruction cache enabled
  Level-1 data cache enabled
  MMU enabled
  Branch prediction enabled
Found 3 JTAG devices, Total IRLen = 13:
 #0 Id: 0x4BA00477, IRLen: 04, IRPrint: 0x1, CoreSight JTAG-DP (ARM)
 #1 Id: 0x00000001
 #2 Id: 0x2191C01D
Cortex-A9 identified.

U-Boot debugging

In this section, it is assumed your board doesn’t boot to U-Boot automatically. That means that the procedure below will explain how to initialize the DDR using the JTAG.

In order to make sure that the board won’t boot on its own, you can configure the boot DIP switch like for USB recovery. You can look at our unbricking blog post in order to see how to position the switch.

Before debugging, you need to build your U-Boot binary. It is assumed that you’ve already read our article on that subject.

Here is an example for the Nitrogen6x/BD-SL-i.MX6 (SabreLite):

~$ git clone https://github.com/boundarydevices/u-boot-imx6 \
   -b boundary-v2016.03
~$ cd u-boot-imx6
~/u-boot-imx6$ export ARCH=arm
~/u-boot-imx6$ export CROSS_COMPILE=arm-linux-gnueabihf-
~/u-boot-imx6$ make nitrogen6q_defconfig
~/u-boot-imx6$ make all

Note that the output ELF binary ready to be debugged is named u-boot.

Using GDB manually

First the GDB server needs to be started.

~$ JLinkGDBServer -device MCIMX6Q6 -if JTAG -speed 1000

The i.MX6SoloX requires a specific script for the server to be able to communicate with the CPU. It can be found here:

Then a GDB session can attach to our local server (to the J-Link) in order to load the ELF binary.

As said previously, the RAM needs to be initialized first before. In order to do so, a gdb init script must be provided to set the clocks and DDR registers like the DCD table would do.

Such GDB init scripts have been created for all our boards:

For BD-SL-i.MX6 (Sabre-Lite), the nitrogen6x one must be used. The GDB command therefore looks like:

~/u-boot-imx6$ wget http://linode.boundarydevices.com/jlink/gdbinit_nitrogen6x
~/u-boot-imx6$ gdb-multiarch u-boot --nx -ix gdbinit_nitrogen6x

At this stage, the DDR and clocks are properly initialized. You now can load the ELF binary and start debugging. Here is an example.

(gdb) load
Loading section .text, size 0x51b34 lma 0x17800000
Loading section .rodata, size 0x130a4 lma 0x17851b38
...
(gdb) b print_cpuinfo
Breakpoint 1 at 0x17801bd4: file arch/arm/imx-common/cpu.c, line 184.
(gdb) c
Continuing.
Breakpoint 1, print_cpuinfo () at arch/arm/imx-common/cpu.c:184
184 {
(gdb) bt
#0 print_cpuinfo () at arch/arm/imx-common/cpu.c:184
#1 0x17848e64 in initcall_run_list (init_sequence=init_sequence@entry=0x17866950 )
 at lib/initcall.c:31
#2 0x178140a4 in board_init_f (boot_flags=) at common/board_f.c:1059
#3 0x17803ac0 in _main () at arch/arm/lib/crt0.S:93

If you are not familiar with GDB, we highly recommend this article.

Using Eclipse IDE

Disclaimer: this section will only detail how to debug U-Boot from the IDE. If you wish to build U-Boot from eclipse, we recommend you to read this pdf.

First, go to File > Import and select C/C++ Executable. Then enter the u-boot binary path into the Select Executable field.

Then the project is ready, the debug configuration now needs to be created. Go to Run > Debug Configurations and create a new GDB Segger J-Link Debugging profile.

uboot_setup1

In the Debugger tab, adjust the settings to match the picture below (Device, Endianness, Connection etc..).

uboot_setup2

Finally, in the Startup tab, copy the memU32 values from the GDB init script mentioned above to the box below.

uboot_setup3

That’s it, you can hit Debug and start debugging your U-Boot source code.

uboot_debugging

Linux kernel debugging

Unlike the U-Boot setup above, the assumption of this section is that the kernel (and its device tree) is loaded from U-Boot. This eases the setup quite a lot, the JTAG just needs to connect to the target and is ready to debug.

For debugging purposes, we recommend using TFTP/NFS setup to load the kernel/device tree/OS.

Before debugging, the kernel must be built. Here are the latest instructions to do so:

~$ git clone https://github.com/boundarydevices/linux-imx6.git \
   -b boundary-imx_4.1.15_2.0.0_ga
~$ cd linux-imx6
~/linux-imx6$ export ARCH=arm
~/linux-imx6$ export CROSS_COMPILE=arm-linux-gnueabihf-
~/linux-imx6$ make boundary_defconfig
~/linux-imx6$ make zImage dtbs modules

If you use TFTP, don’t forget to copy the zImage and dtb file to the root directory of your TFTP server.

The ELF binary that will be used for debugging is called vmlinux

Using GDB manually

Same as before, the GDB server needs to be started.

~$ JLinkGDBServer -device MCIMX6Q6 -if JTAG -speed 1000

Note that 1 JLinkGDBServer can only connect to 1 core, so if you want to debug several cores, you need to start as many GDB servers as cores. Each GDB server instance must use different ports than the other instances. Here is the command to connect to the Core1 for instance:

~$ wget http://linode.boundarydevices.com/jlink/MCIMX6-core-1.JLinkScript
~$ JLinkGDBServer -device MCIMX6Q6 -if JTAG -speed 1000 \
   -scriptfile MCIMX6-core-1.JLinkScript \
   -port 2334 -swoport 2335 -telnetport 2336

Then a GDB session can attach to our local server (to the J-Link) in order to load the ELF binary.

 

~/linux-imx6$ gdb-multiarch vmlinux

At this stage, the DDR and clocks are properly initialized. You now can load the ELF binary and start debugging. Here is an example.

(gdb) target remote localhost:2331
(gdb) b init/main.c:start_kernel
Breakpoint 1 at 0x80c0099c: file init/main.c, line 493.
(gdb) b arch/arm/mm/proc-v7.S:cpu_v7_do_idle
Breakpoint 2 at 0x80119d60: file arch/arm/mm/proc-v7.S, line 72.
(gdb) c
Continuing.

Now that we have set our breakpoints, we can load the kernel from U-Boot. Here is an example using TFTP.

=> dhcp $fdt_addr $tftpserverip:$fdt_file
=> fdt addr $fdt_addr
=> run cmd_hdmi cmd_lcd cmd_lvds
=> tftp $loadaddr $tftpserverip:zImage
=> bootz $loadaddr - $fdt_addr

Then you should see the breakpoints on the GDB console.

Breakpoint 1, start_kernel () at init/main.c:493
493 {
(gdb) c
Continuing.
Breakpoint 2, cpu_v7_do_idle () at arch/arm/mm/proc-v7.S:72
72 dsb @ WFI may enter a low-power mode

Using Eclipse IDE

Just like the U-Boot procedure, go to File > Import and select C/C++ Executable. Then enter the vmlinux binary path into the Select Executable field.

Then the project is ready, the debug configuration now needs to be created. Go to Run > Debug Configurations and create a new GDB Segger J-Link Debugging profile.

As said before, if you want to debug multiple cores, you need to create several debug configurations. Below is the core0 setup.

kernel_setup1

Note the difference with the U-Boot setup, here the Connect to running target is checked.

kernel_setup2

Same here, note that the Initial Reset and Halt is unchecked.

For other cores, the only differences are in the Debugger tab where you need to specify a scriptfile that you can find here. Also the ports must be different, see the Core1 setup below.

kernel_setup3

Then you can create a Launch Group that would start the debugging session on all the cores at once.

kernel_setup4

Finally you can start debugging all the cores.

kernel_debug

The post Debugging using Segger J-Link JTAG appeared first on Boundary Devices.

Getting Started Part 1: Serial Connection

$
0
0

This blog post will hopefully address some common starting questions to those who are new to embedded systems. Things like connecting connectors, setting up serial console (Linux & Windows), and writing sdcard images (Linux & Windows). If you feel we’re missing anything, feel free to comment below and we can expand this blog post, hopefully keeping this as the go-to source for getting started on our boards.

Serial Console

Shipped with all our boards is a console cable, and on all our boards is a header labeled “SERIAL”. The header is labeled J17 on all boards. You can see the cable and where it attaches here for the Nitrogen6x:

20161110_171126

20161110_171418

 

You’ll need to attach the DB9 connector labeled “CONSOLE” to a serial port, or more likely a usb-to-serial converter. Here are pictures of my usb-to-serial converter, just attach the USB cable to your computer and you’re good to go:

serial-setup

When you attach the usb-to-serial converter on Linux, you should be able to see mounting information by grepping dmesg, like “dmesg | grep ttyUSB”, as you can see here you’ll notice it mounts on /dev/ttyUSB0:

ubuntu@boundary:~$ dmesg | grep ttyUSB

[ 26.145040] usb 1-6.4: Keyspan 1 port adapter converter now attached to ttyUSB0

On Windows, you’ll be able to see the device under Device manager.

 

putty2

Our default serial speed rate is 115200 on all our boards, so you’ll need that information to properly configure your console application. There are a great number of console applications you can use on both Linux and Windows. Two popular Linux console applications are “screen” and “minicom”. Personally, I use screen and will give examples for it here, although like many things it comes down to personal preference and how well you know the keyboard shortcuts and configurations.

The screen command is simple, “sudo screen /dev/ttyUSB0 115200” tells the application to open the serial port on /dev/ttyUSB0 and run at the speed 115200bps with admin permissions:

ubuntu@boundary:~$ sudo screen /dev/ttyUSB0 115200

Now if you power the board you’ll see the console start with u-boot:

screen-example

A popular Windows serial console application is PuTTY, you can download it here. You’ll need to configure the serial port under Device Manager and set the baud rate to 115200 as you can see here:

putty4

 

putty5

Then you’ll need to open PuTTY and select the serial radio button and enter the COM# shown in Device Manager as well as setting the baud rate to 115200 and open the console

putty6

Then if you power up your board you should be U-Boot start to load

putty7

 

The post Getting Started Part 1: Serial Connection appeared first on Boundary Devices.

Getting Started Part 2: Writing SDCard Images

$
0
0

Writing SDCard Images

All of our software releases link sdcard images which you’ll need to download and write to a sdcard. This has been said before on our blogs, but it it worth repeating here, the sdcard image is a complete image of the sdcard. The file includes filesystem information and structure (EXT3/4, FAT, etc) and all the partition information and all the files in the partitions. Everything. So there is no prep required on your end, all you need is an sdcard which you are comfortable overwriting.

Linux

On Linux the process is simple. Firstly, you’ll want to plug in the sdcard and figure out where it mounts at. I have a microsdcard to usb dongle and when I plug it into my computer I can look through dmesg and see where it mounts. In this example, you’ll see it mounts at /dev/sdf:

ubuntu@boundary:~$ dmesg

[518482.181498] usb-storage 1-1:1.0: USB Mass Storage device detected
[518482.181653] scsi host34: usb-storage 1-1:1.0
[518483.179586] scsi 34:0:0:0: Direct-Access Generic USB SD Reader 1.00 PQ: 0 ANSI: 0 CCS
[518483.180057] sd 34:0:0:0: Attached scsi generic sg6 type 0
[518483.180461] sd 34:0:0:0: [sdf] 7774208 512-byte logical blocks: (3.98 GB/3.71 GiB)

Then you’ll want to unmount that drive so you can safely write to it. The command is “sudo umount /dev/X*”, replacing X with the mount point. In my example, my unmount command would be:

ubuntu@boundary:~$ sudo umount /dev/sdf*

Then you can write the sdcard image file using the tool “dd”, and if the sdcard image is gzipped then you can unzip the image with “zcat” and pipe the data to “dd”

For gzipped sdcard images:

ubuntu@boundary:~$ zcat example.sdcard.gz | sudo dd of=/dev/X bs=1M
0+86844 records in
0+86844 records out
3263168512 bytes (3.3 GB, 3.0 GiB) copied, 275.794 s, 11.8 MB/s

For standard sdcard images:

ubuntu@boundary:~$ sudo dd if=example.sdcard of=/dev/X bs=1M
0+86844 records in
0+86844 records out
3263168512 bytes (3.3 GB, 3.0 GiB) copied, 275.794 s, 11.8 MB/s

Again, replace X with the device you found from dmesg.

Windows

For Windows we suggest writing sdcard images with this tool: http://www.alexpage.de/usb-image-tool/ (Download links here)

When you open the application, you should see on the left your sdcard. Then you’ll need to press the “Restore” button to write a sdcard image to it.

sdcard-writer1

Next you’ll need to go to the sdcard image’s location on disk. Then select “All Files (*.*)” from the drop down on the bottom right – this will allow the application to find .sdcard or .sdcard.gz files. Select the image and hit “Open”:

sdcard-writer2

Once you hit the Open button, the sdcard writing should start. You’ll see a status bar on the bottom right as it progresses. Once it’s at 100% you’re good to go:

sdcard-writer3

The post Getting Started Part 2: Writing SDCard Images appeared first on Boundary Devices.

Debian Jessie 8.6 for i.MX6/7 boards – December 2016 (kernel 4.1.15)

$
0
0

 

Debian Jessie 8.6 - XFCE4 desktop

Debian Jessie 8.6 – XFCE4 desktop

For those of you who prefer Debian over Ubuntu, we’re glad to offer an updated Debian Jessie with the newest 4.1.15-2.0.0 kernel .

The same good old XFCE4 was used since it offers the best trade-off speed/size for Debian GUI desktop environment. As usual, a console image is also available for those who don’t need a GUI desktop.

These systems contain NXP/Freescale licensed content, so you will need to register on our web-site and log in before you can accept the license agreement and download the images from here:

Important !

Before installing this image please check your U-Boot version. The 4.1.15 kernel requires U-Boot version 2015.07 or higher, version 2016.03 is recommended. With this U-Boot you can use the new USB Mass Storage Gadget to program the eMMC.

Tip: If you want more free space on the console image’s SD card, you can uninstall demos anytime, they take lot of space :

$ sudo apt-get purge imx-gpu-sdk-j8-fb
$ sudo apt-get purge imx-gpu-viv-j8-test

Programming the image

The image is a slightly-less-than-4GiB image file containing the partition table.  Inspired by ubuntu-mate.org, I changed over from dd to another disk copy program called ddrescue. It is a much more talkative program, although dd does do it’s job honestly. I don’t like mute programs, you never know whats happening in a given moment. For example, if you want to create an SD card for a console image, you need to do the following :

$ sudo apt-get install gddrescue xz-utils util-linux
$ gunzip 20161207-nitrogen-4.1.15_2.0.0_ga-jessie-en_US-console_armhf.img.gz
$ sudo ddrescue -D --force 20161207-nitrogen-4.1.15_2.0.0_ga-jessie-en_US-console_armhf.img /dev/sdX

You have to replace sdX with your actual SDHC reader/writer device. Use the lsblk command to check it.

Type lsblk with unplugged SDHC reader, then insert the device, and type lsblk again. A new node will be added , that is your SDHC reader/writer device.

Usernames and passwords

Two users are defined for use on the system: debian and root. The password for each is Boundary (capital B).

An ssh server is configured on the system, though it does not allow password-based authentication for user root.

User debian has sudo privileges, so you can place your ssh public key (normally $HOME/.ssh/id_rsa.pub) to the system like so :

debian@nitrogen:~$ sudo mkdir /root/.ssh
[sudo] password for debian:
debian@nitrogen:~$ sudo nano /root/.ssh/authorized_keys
... paste content of $HOME/.ssh/id_rsa.pub here
debian@nitrogen:~$ sudo chmod 600 /root/.ssh/auth*
debian@nitrogen:~$ sudo chmod 600 /root/.ssh/

What’s supported

Since the images above include our stable 4.1.15 kernel, essentially everything is supported including :

  • Vivante GPU accelerations
  • C&M VPU accelerations
  • Wi-Fi and Bluetooth modules for Tiwi-BLE, Murata, BD_BCOM, QCA9377/Silex
  • All kind of storage devices , SDHC card, eMMC, SATA hdd, USB pen sticks, cell modems
  • All of our supported touch panels
  • IMX Capture devices including OV56xx parallel and mipi cameras, Toshiba BD-HDMI-MIPI converter, UVC cameras
  • It supports i.MX6Q/DL/SX and i.MX7D board’s BSP

The packaging (inluding kernel) is done in the normal debian way, so apt-get update/dist-upgrade will keep your image up and running the latest as patches come out.

What’s new in this release

  • The Linux kernel was upgraded to 4.1.15 ( meta-package name: linux-boundary-12j )
  • GPU driver was upgraded to Vivante 5.0.11p7.4 ( meta-package name: imx-gpu-viv-j8-… ). Unfortunately this is not the latest driver, because the latest one had some problems with chromium-browser. I preferred stability, I’ll upgrade this later when all the problems were eliminated for sure.
  • The module galcore (CONFIG_MXC_GPU_VIV) was removed from the kernel, and it’s an externally built module. This change makes the graphics system modular, and more upgradeable, at the price of longer kernel upgrading time. Upgrading kernel takes about 3-4 minutes now, instead of 30 seconds, because every kernel upgrade rebuilds the galcore driver from sources, because its a DKMS module.
  • The package gstreamer-imx was upgraded to 0.12.3
  • The new NXP/Vivante GPU SDK was added : imx-gpu-sdk 2.2.2 . You can get the source with the usual apt-get source command.
  • The distribution was upgraded to Jessie 8.6 . Here are some main component versions :
    • Xorg server 1.16.4
    • gstreamer1.0 1.4.4
    • bluez 5.23
    • Qt5 5.3.2
    • apt 1.0.9.8.3
    • chromium-browser 48.0.2564.82
    • dpkg 1.17.27
    • gcc/g++ 4.9.2
    • firefox 45.5
    • libwayland 1.6.0
    • XFCE Desktop Environment 4.10.1
  • The desktop icon structure is similar to Ubuntu now, the demo icons are grouped in the same way.
  • Silex WiFi / Bluetooth is now supported in Jessie also, not only in Xenial.

 


Let’s see some interesting new demos,  this is a screen of the imx-gpu-sdk OpenGLESv2 Blur demo, a spinning bubble with environment mapping:

IMX GPU SDK 2.2.2 Gaussian Blur demo

IMX GPU SDK 2.2.2 Gaussian Blur demo

You can find many other interesting samples in the SDK, including GLESv2, GLESv3, OpenVG.


This Qt5  Qml demo below shows how to apply various effects on a running video stream, using GPU shaders :

Qt 5.3.2 QML Video Fx demo

Qt 5.3.2 QML Video Fx demo

You can apply various effects on a playing video and/or recording camera screen . Source is available.


Chromium browser supports WebGL , although its not very fast, it could help a lot to realize some tasks. This is an example from the web:

Chromium WebGL demo

Chromium WebGL demo


We added a modified uvcview for better UVC camera support : 

UVC-View

UVC-View

The above program shows the most popular HD C920 camera, but if someone is willing to spend more on a HDMI -> USB3.0 capture device, the result is even better, almost perfect, crystal clear 1080p video stream depending on the camera, for example Canon/Nikon/Sony DSLR’s or Sony Handycam. The 1920x1080p 30fps is still the barrier, the 4k video comes with the new i.MX8 SoC.


The command line tool bluetoothctl is the same as before, you can create connections, pair up with nearby devices. Just a reminder :

debian@nitrogen:~$ sudo bluetoothctl 
[NEW] Controller 84:DD:20:DA:B1:8F Nitrogen6_max TiWi-BLE [default]
[bluetooth]# scan on
Discovery started
[CHG] Controller 84:DD:20:DA:B1:8F Discovering: yes
[NEW] Device 0C:1D:AF:A2:E3:78 Redmi
[bluetooth]# info 0C:1D:AF:A2:E3:78
Device 0C:1D:AF:A2:E3:78
 Name: Redmi
 Alias: Redmi
 Class: 0x5a020c
 Icon: phone
 Paired: no
 Trusted: no
 Blocked: no
 Connected: no
 LegacyPairing: no
 UUID: OBEX Object Push (00001105-0000-1000-8000-00805f9b34fb)
 UUID: Audio Source (0000110a-0000-1000-8000-00805f9b34fb)
 UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
 UUID: Headset AG (00001112-0000-1000-8000-00805f9b34fb)
 UUID: PANU (00001115-0000-1000-8000-00805f9b34fb)
 UUID: NAP (00001116-0000-1000-8000-00805f9b34fb)
 UUID: Handsfree Audio Gateway (0000111f-0000-1000-8000-00805f9b34fb)
 UUID: Phonebook Access Server (0000112f-0000-1000-8000-00805f9b34fb)
 UUID: PnP Information (00001200-0000-1000-8000-00805f9b34fb)
 UUID: Message Access Server (00001132-0000-1000-8000-00805f9b34fb)
 RSSI: -66
[bluetooth]# pair 0C:1D:AF:A2:E3:78
Attempting to pair with 0C:1D:AF:A2:E3:78
[CHG] Device 0C:1D:AF:A2:E3:78 Connected: yes
[CHG] Device 0C:1D:AF:A2:E3:78 Modalias: bluetooth:v001Dp1200d1436
[CHG] Device 0C:1D:AF:A2:E3:78 UUIDs: 00001105-0000-1000-8000-00805f9b34fb
[CHG] Device 0C:1D:AF:A2:E3:78 UUIDs: 0000110a-0000-1000-8000-00805f9b34fb
[CHG] Device 0C:1D:AF:A2:E3:78 UUIDs: 0000110c-0000-1000-8000-00805f9b34fb
[CHG] Device 0C:1D:AF:A2:E3:78 UUIDs: 00001112-0000-1000-8000-00805f9b34fb
[CHG] Device 0C:1D:AF:A2:E3:78 UUIDs: 00001116-0000-1000-8000-00805f9b34fb
[CHG] Device 0C:1D:AF:A2:E3:78 UUIDs: 0000111f-0000-1000-8000-00805f9b34fb
[CHG] Device 0C:1D:AF:A2:E3:78 UUIDs: 0000112f-0000-1000-8000-00805f9b34fb
[CHG] Device 0C:1D:AF:A2:E3:78 UUIDs: 00001132-0000-1000-8000-00805f9b34fb
[CHG] Device 0C:1D:AF:A2:E3:78 UUIDs: 00001200-0000-1000-8000-00805f9b34fb
[CHG] Device 0C:1D:AF:A2:E3:78 UUIDs: 00001800-0000-1000-8000-00805f9b34fb
[CHG] Device 0C:1D:AF:A2:E3:78 UUIDs: 00001801-0000-1000-8000-00805f9b34fb
[CHG] Device 0C:1D:AF:A2:E3:78 Paired: yes
Pairing successful
[bluetooth]# exit
[DEL] Controller 84:DD:20:DA:B1:8F Nitrogen6_max TiWi-BLE [default]
debian@nitrogen:~$ 

Of course you can use the GUI bluetooth tools as well when you are in the XFCE desktop.

GPU development libraries

The package imx-gpu-viv-j8-dev ( development headers and libraries for OpenGL / ESv2 / ESv3 / Khronos / OpenVG / OpenCL /G2D ) is installed by default. You have to set the headers path, before any other headers, or you might include the mesa headers first, and you don’t want to do that. For example :

export CFLAGS="-I/usr/include/vivante ${CFLAGS}"

and you have to set the library path as well :

export LDFLAGS="-L/usr/lib/arm-linux-gnueabihf/vivante ${LDFLAGS}"

Alternatively you can use the much more precise pkg-config way, in the makefile. Setting the flags in case of X11 system :

PKG_CONFIG_PATH = /usr/lib/arm-linux-gnueabihf/vivante/pkgconfig

EGL :

CFLAGS += $(shell pkg-config --cflags egl_x11)

LDFLAGS += $(shell pkg-config --libs egl_x11)

GLESv1 :

CFLAGS += $(shell pkg-config --cflags glesv1_cm_x11)

LDFLAGS += $(shell pkg-config --libs glesv1_cm_x11)

GLESv2 :

CFLAGS += $(shell pkg-config --cflags glesv2_x11)

LDFLAGS += $(shell pkg-config --libs glesv2_x11)

OpenVG :

CFLAGS += $(shell pkg-config --cflags vg_x11)

LDFLAGS += $(shell pkg-config --libs vg_x11)

In case of FB backend change the _x11 postfix above to _fb, thats all.

OpenCL is the same at both fb and x11 :

CFLAGS += $(shell pkg-config --cflags opencl)

LDFLAGS += $(shell pkg-config --libs opencl)

Check the directory /usr/lib/arm-linux-gnueabihf/vivante/pkgconfig for more information


 

As always, please give us some feedback and let us know how things work for you.

The post Debian Jessie 8.6 for i.MX6/7 boards – December 2016 (kernel 4.1.15) appeared first on Boundary Devices.

Safety Critical HMI with CoreAVI

$
0
0

This blog post features two demonstration videos made by CoreAVI that showcase their OpenGL Safety Critical (SC) driver expertise.

The demos are using the CoreAVI OpenGL SC driver, which is designed to support real time and safety critical platforms. Both are running on Boundary Devices Nitrogen6x.  CoreAVI currently has Open GL SC drivers for the i.MX6 family that support: Wind River VxWorks, SYSGO PikeOS, DDCI Deos and Linux.  In addition, they have Open GL SC drivers for the i.MX6 Solo (GC880), i.MX6 Quad (GC2000) and i.MX6 Quad Plus (GC3000).  

The company offers product support availability for the following safety certifications:

  • ISO 26262 ASIL D
  • RTCA DO-178C / EUROCAE ED-12C DAL A

1. CoreAVI Avionics demo

This video shows a 3D Glass Cockpit application and a 2D Glass Cockpit application.

The top application is a 2D Glass Cockpit application running on Wind River VxWorks.

The bottom application is a 3D Glass Cockpit application running on Linux (for demo purposes, not certified).

2. CoreAVI Automotive demo

This video shows an automotive cluster application and an Infotainment application.

The top application is an Infotainment application running on SYSGO PikeOS.
The bottom application is an automotive cluster demo running on SYSGO PikeOS.

 

As usual, feel free to leave a comment below or contact us/CoreAVI for more information.

The post Safety Critical HMI with CoreAVI appeared first on Boundary Devices.

Morty Yocto Release

$
0
0

A new Yocto 2.2 release, Morty, is now available.

For The Impatient

How to Burn

To burn the image file to a sdcard, run this command assuming your sdcard is mounted on /dev/sdc

~$ sudo umount /dev/sdc*
~$ zcat boundary-eval-image-nitrogen6x-morty.sdcard.gz | sudo dd of=/dev/sdc bs=1M

How to Replicate

This image uses a new “morty” boundary-bsp-platform that can be used to build images for our boards. Lots of this is identical to what was present in our previous images, although a lot has been improved. This is mostly a clone of fsl-community-bsp-platform with meta-browser, meta-qt5, and meta-boundary added in. There is also a Boundary-Devices-centric setup-environment script with a central download area and cache and some extras to the default local.conf.

Firstly, you’ll need to create the download/cache folders and give r/w access.

~$ sudo mkdir -p /opt/freescale/yocto/imx
~$ sudo mkdir -p /opt/freescale/yocto/sstate-cache
~$ sudo chmod -R 777 /opt/freescale

To build the image, you’ll need these packages installed as well as this repo tool that can be installed like this:

~$ sudo apt-get install repo

Now create your build directory and initialize everything.

~$ mkdir ~/morty
~$ cd ~/morty
~/morty$ repo init -u http://github.com/boundarydevices/boundary-bsp-platform -b morty
~/morty$ repo sync

Now setup the environment for building. In this example I’m targeting the nitrogen6x, however nitrogen6x-lite, nitrogen6sx, and nitrogen7 are all also valid MACHINE targets here. Use whatever your platform is. Take a look through those MACHINE configuration files linked, you’ll notice the nitrogen6x MACHINE configuration covers many different boards. The other three configurations cover only one board.

There is a new DISTRO variable which controls what sort of image you’re building. You can see all the fslc-DISTROs here. This variable controls what sort of graphics the image is based on. If the image is X11 based, then you’d select DISTRO=fslc-x11, for wayland you’d select fslc-wayland, xwayland fslc-xwayland and so on.

Our boundary-eval-image is X11 based, so you’ll need to select DISTRO=fslc-x11. Then choose whichever MACHINE is relevant for you.

~/morty$ MACHINE=nitrogen6x DISTRO=fslc-x11 . setup-environment boundary-eval-image

Now bitbake boundary-eval-image

~/morty/boundary-eval-image$ bitbake boundary-eval-image

Now after some time this should build the same image as above. The image file will deploy to ~/morty/boundary-eval-image/tmp/deploy/images/{MACHINE}/boundary-eval-image-{MACHINE}.sdcard.gz. Feel free to tweak and add things as you see fit.

Chromium

Chromium is working and very stable in this image (finally!). It’s version is now 52.0.2743.76.

chromium-morty

Firefox

Firefox is also available and stable. It’s version is 45.5.1esr.

firefox-morty

Video Input Tests

If you have our ov5640-mipi camera, ov5642 camera, or our HDMI input daughterboard the image includes easy desktop icons to launch tests for the respective hardware.

morty-desktop

Launching the respective video input test will show up on the screen and look like this:

camera-morty

Wifi

The builds include a wifi auto-start script which will connect to any open wireless network, or any secured network that you have configured. To add a wifi network with security, run this command and reboot and your board should automatically connect to the network.

root@nitrogen6x:~# wpa_passphrase <network> <passphrase> >> /etc/wpa_suplicant.conf
root@nitrogen6x:~# reboot

Bluetooth

For products with Bluetooth, you’ll be able to connect using these commands:

root@nitrogen6x:~# echo 0 > /sys/class/rfkill/rfkill0/state
root@nitrogen6x:~# echo 1 > /sys/class/rfkill/rfkill0/state 
root@nitrogen6x:~# hciattach -t 30 -s 115200 /dev/ttymxc2 texas 3000000 flow
Found a Texas Instruments' chip!
Firmware file : /lib/firmware/ti-connectivity/TIInit_7.6.15.bts
Loaded BTS script version 1
texas: changing baud rate to 3000000, flow control to 1
Bluetooth: HCI UART driver ver 2.3
Bluetooth: HCI UART protocol H4 registered
Bluetooth: HCI UART protocol LL registered
Device setup complete
root@nitrogen6x:~# hciconfig hci0 up
root@nitrogen6x:~# hcitool scan
Scanning ...
11:22:DE:AD:BE:EF    Some Device
For Silex: Use this hciattach command instead: hciattach /dev/ttymxc2 qca 1000000 -t30 flow

Silex Module Support

If you have a silex wifi/bluetooth module on your board these images come with that supported. You can also build this module by adding kernel-module-silex and linux-firmware-silex to your image by adding this line to the end of your local.conf file: IMAGE_INSTALL_append += “kernel-module-silex linux-firmware-silex”. This can also be uncommented on this line in the image recipe to add it.

As you can see in the linux-firmware-silex recipe you’ll need access to our git repository to pull and compile that code. Please fill out this form to get access to our private git repositories.

You can also read our blog post about the Silex module.

XFCE Desktop Based Image

We also have an evaluation image with the XFCE desktop. This is the same desktop environment seen in our latest Debian image, so if you prefer that or just want to see something different you can try this image out.

To build this image, instead of “bitbake boundary-eval-image” you should do “bitbake boundary-eval-image-xfce”.

xfce-screenshot

The post Morty Yocto Release appeared first on Boundary Devices.


Boundary Devices Launches Wiki Page

$
0
0

We’ve been providing news / tips & tricks via our blog for years. Although it is a great source of information, we have seen some customers get lost or have difficulty finding information. That is why we are glad to introduce Boundary Devices Wiki.

For the impatient

Wiki

Boundary Devices Wiki

What’s in the Wiki?

Well, for starters, it isn’t a true Wiki since it isn’t based on the “collaborative” template. The main reason is that it mostly points to articles previously written.

So it can be seen as a directory for all of our previous content. The goal is to have a single entry point for all customers to get information.

We therefore picked the most useful posts and discarded the one we thought outdated.

The following sections have been created:

  • Getting Started
    • When you receive your platform, this section should give you all the pointers to boot/flash/recover the device
  • U-Boot
    • Information about the U-Boot bootloader from building to flashing
  • Linux Kernel
    • Information about the Linux kernel from building to customization
  • Operating Systems
    • Here are supported OS and their latest releases
  • Application development
    • Where to learn how to write apps on each supported OS
  • Demos
    • Lists all the demos running on our platforms
  • Boundary Devices Platforms
    • Points to our available platforms
  • Blog
    • Points to our blog

Feedback

Once again, this has been created to ease your life when looking for information about our platforms/releases.

It is very important to us that it makes sense to you, so please feel free to provide your feedback in the comment section below.

If there is something you don’t find, it means we missed it or that a new blog post is in order.

The post Boundary Devices Launches Wiki Page appeared first on Boundary Devices.

Ubuntu Core 16 for i.MX6 and i.MX7 platforms

$
0
0

We are proud to share our first Ubuntu Core release for all our i.MX platforms.

For the impatient

You can download the OS image from here:

The image is a 1GB SD card image that can be restored using zcat and dd under Linux.

~$ zcat ubuntu-core-nitrogen-*.img.gz | sudo dd of=/dev/sdX

For Windows users, please use Alex Page’s USB Image Tool.

What is Ubuntu Core?

Ubuntu Core is a minimalist rendition of Ubuntu. It is a lightweight, transactionally updated OS, where every application is installed confined from others. It is designed to run securely on autonomous machines, devices and other internet-connected digital things.

Compared to a “regular” Ubuntu image, it offers:

  • Faster, more reliable and stronger security guarantees for apps and users.
  • Atomic transactional upgrades for apps and the OS itself (with roll-back).
  • Snaps, a new and simple application packaging system.
  • Signature authentication to prove that what’s running is secure.

What are the requirements?

An Ubuntu SSO account is required to create the first user on an Ubuntu Core installation.

  1. Start by creating an Ubuntu SSO account
  2. Import an SSH Key into your Ubuntu SSO account on this page.
    • Instructions to generate an SSH Key on your computer can be found here.

Once the account is properly created you will be able to login to the image and installing or developing snap packages.

What are snap packages?

As the website puts it, a snap is:

  • a squashFS filesystem containing your app code and a snap.yaml file containing specific metadata. It has a read-only file-system and, once installed, a writable area.
  • self-contained. It bundles most of the libraries and runtimes it needs and can be updated and reverted without affecting the rest of the system.
  • confined from the OS and other apps through security mechanisms, but can exchange content and functions controlled by OS policies.

So every piece of software must be bundle into a snap package. For instance, the entire base OS is packaged inside the core snap.

Then the kernel and its firmware and modules are packaged inside a specific kernel snap. Another mandatory snap package to boot a system is called gadget which contains bootloader environment to allow to boot the board.

How to build an application?

This will not be covered in this article since the Ubuntu Core website covers the subject very well:

How to build an OS image?

First, we provide all the source code required to build the gadget and kernel snaps to make an image that runs on all our platforms:

As the repository documentation says, it is highly recommended to build from Ubuntu 16.04 or later.

You first need to install the following packages in order to build Ubuntu Core.

~$ sudo apt update
~$ sudo apt install -y build-essential u-boot-tools lzop gcc-arm-linux-gnueabihf
~$ sudo apt install -y snap snapcraft
~$ sudo snap install ubuntu-image

 Then the build is pretty straight-forward:

~$ git clone https://github.com/boundarydevices/ubuntu-core.git
~$ cd ubuntu-core
~/ubuntu-core$ make

The output file should be named ubuntu-core-nitrogen-yyyymmdd.img.gz.

Getting started

Now that you’ve flashed the pre-built (or your own) image, you can start experiencing with the OS.

This section will provide some information we think are important to get started with Ubuntu Core.

First Boot

  1. The system will boot then become ready to configure
  2. The device will display the prompt “Press enter to configure
  3. Press enter then select “Start” to begin configuring your network and an administrator account.
  4. Follow the instructions on the screen, you will be asked to configure your network and enter your Ubuntu SSO credentials.
  5. At the end of the process, you will see your credentials to access your Ubuntu Core machine.
ssh <Ubuntu SSO user name>@<device IP address>

At this point, the SSH key registered to your Ubuntu SSO account is on the target and you should be able to access the platform without any other credential required.

NOTE: at bootup a network.py warning can appear if your board has a WiFi module. This is a warning telling us the interface is busy, there’s no harm but we are investigating a work-around.

Useful snap commands

The snap tool offers many features, here will be listed the one we used:

  • Use list to see the installed packages and their version
user@localhost$ snap list
Name Version Rev Developer Notes
core 16-2 1267 canonical -
nitrogen-gadget 16.04-1 x1 -
nitrogen-kernel 4.1.15-1 x1 -
snapweb 0.21.2 25 canonical -
  • Use info to learn about a specific snap
user@localhost$ snap info core
name: core
summary: "snapd runtime environment"
publisher: canonical
description: |
 The core runtime environment for snapd
type: core
tracking: stable
installed: 16-2 (1267) 67MB -
refreshed: 2017-02-21 09:42:38 +0000 UTC
channels: 
 stable: 16-2 (1267) 67MB -
 candidate: 16-2 (1443) 69MB -
 beta: 16-2 (1443) 69MB -
 edge: 16-2 (1491) 69MB -
  • Use refresh to update your components
user@localhost$ snap refresh

NOTE: at the time of this writing, the beta (1443) became stable and breaks the boot, a snap refresh will most likely fail. We are investigating the issue with Canonical.

  • You can even change a snap package using refresh
user@localhost$ snap refresh core --edge
  • Use changes to learn about the system changes
user@localhost$ snap changes
ID Status Spawn Ready Summary
1 Done 2017-03-14T14:43:28Z 2017-03-14T14:48:10Z Initialize system state
2 Doing 2017-03-14T14:56:00Z - Initialize device
  • Use install to install a new package (like you would apt install)
user@localhost$ snap install bluez

Manage your device remotely

Our image comes with the snapweb package which allows you to manage your device via a web interface.

Simply visit the https://<ip of the board>:4201 and should see the following window.

snapweb_token

This token needs to be generate by the device, so you need to run the following command via SSH:

user@localhost$ sudo snapweb.generate-token

Then enter the provided token and click on Submit.

snapweb_home

You can see above that the web page shows which packages are currently installed.

On the top right corner can be seen a Browse Store button which allows you to see which snap can be installed.

snapweb_store

As an example, we will install the qrcode-terminal application.

snapweb_install

Once installed, it is possible to generate QRCode on the platform as expected:

user@localhost$ sudo su -c "qrcode-terminal 'https://boundarydevives.com' > /dev/tty0"

qrcode_terminal

Setting up a WiFi connection

In order to setup a WiFi connection, you need to first enable the interface by creating a new configuration file:

user@localhost$ sudo vi /etc/network/interfaces.d/wlan0
auto wlan0
iface wlan0 inet dhcp
    wpa-conf /home/<username>/wireless-setup.conf

Then in your home folder, you create add known SSID to the wireless-setup.conf file.

user@localhost$ wpa_passphrase <SSID> <passphrase> >> wireless-setup.conf

You now need to reboot and the platform will connect automatically to the listed SSID.

 

That’s it, this post should be a good introduction to this OS and how to use it on our platforms.

As usual, feel free to leave a comment below, letting us know what is your experience.

The post Ubuntu Core 16 for i.MX6 and i.MX7 platforms appeared first on Boundary Devices.

U-Boot v2017.03

$
0
0

We’re glad to release the latest U-Boot v2017.03 with support for all our platforms:

For the impatient

Our build server automatically generates and uploads all the latest binaries to this address:

The README file contains the exact commit ID of this build images.

Also, the up-to-date 6x_upgrade U-Boot script is included so you can copy all the files directly to the root of your media storage.

For those not sure about which binary to download, here is a quick summary for our boards:

What’s new?

First, this version includes all the latest features and fixes available from mainline U-Boot.

One noticeable change is the use of Kconfig to select most of the options now (instead of piling them up in the config header).

U-Boot v2017.03 Kconfig

Also, another important change is the support of sparse images when using Android fastboot tool.

Build instructions

The usual compilation disclaimers apply for this. It is highly recommended to use the gcc-arm-linux-gnueabihf package available on Ubuntu/Debian.

~$ sudo apt-get install gcc-arm-linux-gnueabihf

First, clone our U-Boot git repository. This is the branch you’ll need to compile and install to work with the new kernel.

~$ git clone https://github.com/boundarydevices/u-boot-imx6 \
    -b boundary-v2017.03
~$ cd u-boot-imx6

Here you’ll need to find and make the relevant defconfig for your board.

If you are using a U-Boot >=2015.07, then at the U-Boot prompt you can type the following to see which defconfig you should build.

=> echo $uboot_defconfig

Otherwise, to see all the defconfigs, use this command and pick the one that is right for you.

~/u-boot-imx6$ find . -name "nit*defconfig"
./configs/nitrogen6_vm1g_defconfig
./configs/nitrogen6q2g_defconfig
./configs/nitrogen6dl2g_defconfig
./configs/nitrogen6s1g_defconfig
./configs/nit6xlite_defconfig
./configs/nitrogen6q_fl_defconfig
./configs/nitrogen7_defconfig
./configs/nitrogen6q_som2_2g_defconfig
./configs/nitrogen6sx_defconfig
./configs/nitrogen6dl_defconfig
./configs/nitrogen6q_defconfig
./configs/nitrogen6s_defconfig
./configs/nitrogen6_lum_dl1_defconfig
./configs/nitrogen6_vm_defconfig
./configs/nitrogen6q_som2_1g_defconfig
./configs/nitrogen6q_som2_4g_defconfig
./configs/nit6xlite1g_defconfig
./configs/nitrogen6qp_max_defconfig
./configs/nitrogen6_max_defconfig

 Now compile that defconfig, here I’ll use nitrogen6q_defconfig as an example.

~/u-boot-imx6$ export ARCH=arm
~/u-boot-imx6$ export CROSS_COMPILE=arm-linux-gnueabihf-
~/u-boot-imx6$ make nitrogen6q_defconfig
~/u-boot-imx6$ make -j2
~/u-boot-imx6$ ./tools/mkimage -A arm -O linux -T script -C none \
-a 0 -e 0 -n "update script" \
-d board/boundary/nitrogen6x/6x_upgrade.txt 6x_upgrade

Flashing procedure

Now you’ll have a u-boot.imx file compiled. Rename the u-boot.imx file to u-boot.{uboot_defconfig} (see below), then move that and the 6x_upgrade script to the root folder of your media (SD Card / USB / SATA drive).

~/u-boot-imx6/$ cp u-boot.imx <mount_path>/u-boot.<uboot_defconfig>
~/u-boot-imx6/$ cp 6x_upgrade <mount_path>/

Plug your media to the platform, power up the board and interrupt u-boot to run the commands below.

If your u-boot prompt is “U-boot >” then you need to set uboot_defconfig to the value that matches your platform.

Here is an example for Nitrogen6x/BD-SL-i.MX6:

Hit any key to stop autoboot:  0 
U-Boot > setenv uboot_defconfig <uboot_defconfig>
U-Boot > run upgradeu

Otherwise just run:

Hit any key to stop autoboot:  0
=> run upgradeu

This will run the 6x_upgrade script and look for a file u-boot.${uboot_defconfig} and burn it. At this point it might be worth while to clear your environment variables, this will set you up with the default environment variables and no more.

Hit any key to stop autoboot:  0 
=> env default -a
=> savee

Then as a final note, if you’ve somehow managed to brick your board through this process and need help. Well, we already wrote a blog post here about that topic.

The post U-Boot v2017.03 appeared first on Boundary Devices.

Android Nougat 7.1.1 release for i.MX6 boards

$
0
0

We are glad to deliver the latest Android Nougat 7.1.1 GA release for most our i.MX platforms:

Android Nougat

We now recommend this release for new designs.


For the impatient

You can download the Android Nougat images from here:

Update 20170426 changelog:

  • Improved BT rfkill management for Silex module
  • Fixed CMA default amount for MAX boot
  • Fixed HDMI unblank issue

As usual, you’ll need to register on our site and agree to the EULA because it contains Freescale content.

The image is a 4GB SD card image that can be restored using zcat and dd under Linux.

~$ zcat n711*.img.gz | sudo dd of=/dev/sdX bs=1M

For Windows users, please use Alex Page’s USB Image Tool.

What’s new?

This section will only describe the changes brought either by the OS update itself or modified/added features.

Android Nougat updates

Here is a non-exhaustive list of noticeable changes between Android 6.0.1 and 7.1.1:

  • Security enhancements
    • SELinux policies more strict
    • File-based encryption: better isolate and protect files for individual users
  • UI updates
    • Customizable Quick Settings: Rearrange your Quick Setting tiles so you can get to what you want faster

Quick Settings icons

    • Settings suggestions: Within Settings, get suggestions for how to get even more out of your device

Settings Suggestions

    • ‘Clear all’ in Overview: Instantly close all of your apps running in the background by tapping ‘clear all’ in Overview

Clear All

  • Browser app is gone
    • It is instead replaced with a Browser2 which offers a simplistic WebView
    • Let us know if that affects your application, there are some people porting the old app forward
  • Multi-Window mode
    • Works a lot better than the experimental version of Marshmallow
    • Simply perform a long press on the Overview button (square next to home button) to trigger that mode

Multi-Window

Google also provides a list of notable changes for developers:

For a more complete changelog between the two versions, we invite you to look at the very nice Opersys website which lists all the different commits between every version:

Same as before, TiWi-BLE offer the WiFi-P2P feature (also called WiFi Direct) but its firmware has proven not be stable.

In case you want to disabled that feature to have a more stable connection, enter the following command line:

~/$ adb shell 'setprop persist.sys.wifidirect disabled'

Linux Kernel 4.1.15

This Android Nougat release is based on a 4.1.15 kernel. It therefore benefits from all our latest drivers/fixes as well as newest Vivante graphics libraries (v6.2.0.p2).

As a reminder, kernel 3.14 and above require to use a modern U-Boot so please make sure to update U-Boot.

U-Boot v2017.03

As said in the previous section, using a Linux Kernel >= 3.14.x now requires to have a recent U-Boot version due to our new display detection mechanism.

Moreover, U-Boot versions prior to v2017.03 did not support sparse images properly.

More information on those U-Boot changes on a previous blog post:

As of this writing, the latest version we support is the 2017.03. You can download binaries directly from this webpage:

Boundary Devices additions

  • Camera HALv3 improvements
    • This releases offers continuous autofocus support for our cameras
    • Also the ‘focus to area’ feature is fully working for our OV5640_MIPI
      • The OV5642 firmware seems to be limited to that regard
    • Below is an example where we force the focus to happen at the bottom right corner instead of center:

Area focus

~/myandroid$ sed -i 's/TI/QCA/' device/boundary/nitrogen6x/wifi_config.mk

BLE advertising

  • Fastboot support improvement
    • Requires to use latest U-Boot v2017.03 for sparse support
    • Created some convenient scripts to generate a GPT binary and flash an empty platform:
~/myandroid$ export PRODUCT=nitrogen6x
~/myandroid$ ./device/boundary/scripts/create_gpt.sh 3600
~/myandroid$ ./device/boundary/scripts/flash_fastboot.sh
  • ExFAT, NTFS and Ext4 file systems are supported for all external media
    • Even with SELinux enforced!
  • Display rotation setting from U-Boot
    • This release allows you to set the default orientation from U-Boot
    • Avoids having to modify the image/source code just for that
=> setenv hwrotation 270
=> saveenv
=> reset
  • Rooted device (su)
    • Since Koush app isn’t supported anymore, we didn’t have a root option
    • Decided to integrate LineageOS su binary but without modifying the core OS
    • It gives a simple way to provide ‘su’ capability to your app
    • To enable it, you need to add the following to your init.rc:
on boot
    start su_daemon

service su_daemon /system/xbin/su --daemon
    disabled
    • By default, only privileged/system apps can use ‘su’
    • If you want any app to be able to use (at your own risks) add the following to your BoardConfig.mk
BOARD_SU_ALLOW_ALL := true

Source code access

For the newcomers, please make sure to read our “Android Getting Started Guide” since it contains all the information you need to download, build and flash an Android image.

For those already familiar with our releases, here is a condensed version to get the Android Nougat source code:

~/$ mkdir myandroid
~/$ cd myandroid
~/myandroid$ repo init -u git://github.com/boundarydevices/android-manifest.git \
       -b boundary-imx-n7.1.1_1.0.0-ga
~/myandroid$ repo sync
~/myandroid$ source build/envsetup.sh
~/myandroid$ lunch
... choose nitrogen6x / nit6xlite / nitrogen6sx from the list of boards
~/myandroid$ make 2>&1 | tee build.out

 

As always, let us know your experiences (both good and bad) when you test out this image.

The post Android Nougat 7.1.1 release for i.MX6 boards appeared first on Boundary Devices.

QNX SDP 7.0 for i.MX platforms

$
0
0

In our quest to offer the latest and greatest support to our customers, we are glad to release our QNX SDP 7.0 BSP for the following platforms:

For the impatient

You can download the QNX SDP 7.0 BSP from here:

Those archives contain pre-built QNX IFS/IPL as well as a release notes documentation.

As for BSP building, we strongly recommend reading our QNX Getting Started Guide article to learn that process.

Note that Nitrogen7 BSP will be available soon.

QNX SDP 7.0 features

QNX Software Development Platform (SDP 7.0) provides a comprehensive, multi-level, policy-driven security model incorporating best-in-class security technologies from BlackBerry.

Here is a short list of new features:

  • High performance: Full 64-bit and 32-bit support for ARMv7, ARMv8.
  • Complete hardware optimization: NXP i.MX platforms.
  • GPU integration: Vivante (GC300, GC2000, GC3000)
  • Standards-based tools: Eclipse-based IDE with C++14 support.
  • Safety certified pedigree: ISO 26262 ASIL D for automotive, IEC 61508 SIL3 for industrial and IEC 62304 for medical.

Another noticeable change is the use of the QNX Software Center which is now necessary to install the QNX base OS. It will also allow to easily install OS updates and new components.

Here is a full list of features from this OS update:

Also, the online documentation is as usual very well-written and detail-oriented:

For instance, there’s a migrating guide that can be useful for your existing applications:

Boundary Devices BSP update

Compared to our QNX SDP 6.6 BSP, this release brings the following improvements:

For the full list of features, please read our Release Notes documentation inside the BSP package.

From a BSP standpoint, one noticeable change is the use of the new io-usb-otg USB stack which works for both Host & Device modes.

gles2-gears running on QNX7.0

gles2-gears running on QNX7.0

Note that, as of this writing, Qt adaptation to QNX7.0 is still in Beta, please contact QNX for more details.

However as soon as it is ready for release, it will appear as a new package in the QNX Software Center.

The post QNX SDP 7.0 for i.MX platforms appeared first on Boundary Devices.

Update on BD-SDMAC WiFi/BT module

$
0
0

We introduced the Silex QCA9377-based BD-SDMAC few months ago and have some updates to provide.

BD-SDMAC

802.11 AC + BT4.1 BD-SDMAC module

First, it is recommended to read our previous blog post which gives all the module details:

As a reminder, the module is supported in the following OSes:

  • Android
  • Ubuntu
  • Debian
  • Yocto
  • Buildroot

What’s new?

Supported platforms

After several successful designs using this module, we decided to offer a variant of the following platforms with BD-SDMAC instead of the TiWi-BLE:

Note that the price stays the same for the “_QCA” variants although it now offers dual-band + AC support.

Software update

Projects based on this module were for both Android and Linux which allowed to extensively test the software in real condition.

This process allowed us to fix a few bugs and provide better software support:

  • WiFi MAC addresses can now easily be set from kernel command-line
  • Same goes for BT MAC address on Android (see ro.boot.btmacaddr)
  • Debug messages now stripped not to spam on serial connection
  • Fixed build with GCC6+
  • Firmware update to v2.1.3
  • Bluetooth LE Advertising testing

This latter feature will be described in the next section since many customers have been asking about it.

Bluetooth LE Advertising

The BD-SDMAC is the first module we’ve successfully used BLE advertising.

For Android, an API is provided for it as well as some samples apps that can be used as-is:

Our latest Android Nougat blog post shares the apk files used for testing with some screenshots:

As for Linux, here are some samples commands tested on a Yocto build to send advertising packets (credits to this stackoverflow thread).

  • First setup the BT
echo 0 > /sys/class/rfkill/rfkill0/state
sleep .5
echo 1 > /sys/class/rfkill/rfkill0/state
/usr/libexec/bluetooth/bluetoothd &
hciattach -t 30 /dev/ttymxc2 qca 2000000 flow &
hciconfig hci0 up
  • Then prepare the packet
hcitool -i hci0 cmd 0x08 0x0008 10 02 01 1a 0c ff 18 01 48 45 4c 4c 4f 57 4f 52 4c 44
  • Finally allow advertising packets and incoming connections
hciconfig hci0 leadv 0
  • You can then disable advertising if needed
hciconfig hci0 noleadv

 

For any further information, feel free to contact us at info@boundarydevices.com.

The post Update on BD-SDMAC WiFi/BT module appeared first on Boundary Devices.

Webinar – Qt for Device Creation on i.MX6 and i.MX7 platforms

$
0
0

Qt for Embedded Device Creation and Boundary Devices

Kick-start your embedded project with Qt for Device Creation and Boundary Devices.  WEBINAR JUNE 7th, 2017 at 9AM PST

Attendees will learn how to leverage the latest Qt to create beautiful cross-platform applications and embedded devices including NXP i.MX series.

Based on C++, Qt allows for maximum performance on embedded devices. We will go through what Qt for Device Creation is and how you can quickly deploy an application with Boundary Devices reference boards. We will share insider stories of successful embedded projects, as well.

Presenters:

  • Nils Christian Roscher-Nielson, Product Manager, The Qt Company
  • Gary Bisson, Embedded Software Engineer, Boundary Devices

Details: This webinar is 30 minutes plus Q&A.

The presentation slides and recording will be shared so please don’t hesitate to register even if you are not able to attend.  Link here:

Qt for Embedded Device Creation and Boundary Devices

The post Webinar – Qt for Device Creation on i.MX6 and i.MX7 platforms appeared first on Boundary Devices.


Customizing Ubuntu/Debian kernels on i.MX6/7 boards

$
0
0

 This post is an update to our previous Ubuntunizing i.MX6 kernels in order to allow you to customize your image.

Also I try to give you a guide how to modify and customize the system image on the host PC before installing it on SD card. You can automatize the process if you want and you’ll get the a customized and ready to work system image as result.

1. Preparing and building kernel

As usual, the first step is cloning and building the kernel as it was described earlier in our Cross Compiling Kernels post:

~/$ git clone https://github.com/boundarydevices/linux-imx6.git && cd linux-imx6
~/linux-imx6$ make -C ubuntunize prerequisites
~/linux-imx6$ export KERNEL_SRC=$PWD
~/linux-imx6$ export INSTALL_MOD_PATH=$KERNEL_SRC/ubuntunize/linux-staging
~/linux-imx6$ export ARCH=arm
~/linux-imx6$ export CROSS_COMPILE=arm-linux-gnueabihf-
~/linux-imx6$ git checkout boundary-imx_4.1.15_2.0.0_ga
~/linux-imx6$ make boundary_defconfig
... make your customization, code or configuration changes here.
~/linux-imx6$ make zImage modules dtbs -j8
~/linux-imx6$ make -C ubuntunize tarball
~/linux-imx6$ cd ..

Let’s see line by line:

  1.  Clone Boundary’s linux-imx6 repository.
  2.  Install the armhf cross-toolchain.
  3.  Set KERNEL_SRC variable, it’s needed for building modules.
  4.  Set INSTALL_MOD_PATH variable, it’s needed for installing modules here and later too.
  5.  Set the target architecture.
  6.  Set the CROSS_COMPILE prefix.
    • We recommend using the official cross-toolchain that comes with Ubuntu/Debian.
  7.  Checkout the kernel branch you need. At the time of this writing, you can choose between the following versions (later this list will be extended): 
    • 3.14.28_1.0.0_ga
    • 3.14.52_1.1.0_ga
    • 4.1.15_2.0.0_ga
  8.  Create the config file. If you have one of these boards, you need to use boundary_defconfig. Custom designs have their own specific defconfig.
  9.  Now you can customize the kernel configuration by running make menuconfig enable/disable options/modules as you wish. 
  10.  Build the kernel image (zImage), the modules (.ko) and the device tree blob (.dtb) files using 8 CPU cores.
  11.  This command copies the new files in a directory named linux-staging, and then creates a tarball of it.
    • Although the folder name is “ubuntunize”, this process also works with Debian images.
    • The kernel’s tarball is placed into the ubuntunize/ directory, and is named with the kernel version. If you modified the kernel source, then a -dirty flag will be appended to the name.
~/linux-imx6$ ls -l ubuntunize
total 39852
-rwxr-xr-x 1 tele tele      242 Jun 2 08:49 apt-upgrade.sh
-rw-rw-r-- 1 tele tele     2194 Jun 2 17:05 common.mk
-rwxr-xr-x 1 tele tele      118 Jun 2 05:02 create-initrd.sh.in
-rw-rw-r-- 1 tele tele 40778707 Jun 2 08:43 linux-4.1.15-gff461ec-dirty.tar.gz
drwxrwxr-x 4 tele tele     4096 Jun 2 08:43 linux-staging
-rw-r--r-- 1 tele tele     3296 Jun 2 06:14 Makefile
-rw-rw-r-- 1 tele tele     2767 Jun 2 18:00 Merge.mk
-rwxr-xr-x 1 tele tele      204 Jun 2 05:37 uninstall-kernel.sh

2. Building galcore and other modules

The galcore is a kernel module which is necessary to run Vivante GPU acceleration packages. Since the galcore module version must match exactly the version of the libraries in the rootfs, it is important to be able to build it independently from the kernel. You have to build this external module only if the kernel version is 4.1.15 or higher. Earlier system images with earlier kernels contain built-in galcore module.

Here is the procedure to generate the module using the version of your choosing.

~/$ git clone https://github.com/Freescale/kernel-module-imx-gpu-viv.git && cd kernel-module-imx-gpu-viv
~/kernel-module-imx-gpu-viv$ git checkout upstream/5.0.11.p7.4
~/kernel-module-imx-gpu-viv$ sed 's,-Werror,-Werror -Wno-error=misleading-indentation,g' -i ./kernel-module-imx-gpu-viv-src/Kbuild
~/kernel-module-imx-gpu-viv$ make -j8
~/kernel-module-imx-gpu-viv$ make modules_install
~/kernel-module-imx-gpu-viv$ cd ..

Before you start building this module you have to select the galcore version, it could be 5.0.11.p7.4 or 5.0.11.p8.6 or above version in the future.

It depends on rootfs you are going to use, so you have to check that first. Please boot the original Ubuntu/Debian system (what you are going to modify) on your board. Open a console window and type:

~/$ dpkg -l | grep imx-gpu-viv

In the 2nd column you’ll find the version. As of this writing, systems with X11 desktop usually use the 5.0.11.p7.4 driver and some console images use 5.0.11.p8.6.

Here is a line by line details of the procedure:

  1.  Clone the galcore repository from Freescale’s Github.
  2.  Set the matching branch as described above.
  3.  This sed command is only necessary if you use gcc 6 or higher, which will be used in Debian Stretch for instance.
    • This is a new kind of warning, but it would be considered as error, because of strict module building rules, so it must be disabled.
  4.  In this line we build the module. You don’t need to worry about KERNEL_SRC variable, because it was set earlier. We use 8 CPU cores.
  5.  Install the galcore module in place. You don’t need to worry about INSTALL_MOD_PATH variable, it was set earlier.
    • The module will be copied to a directory named extra.

Similarly to galcore, you can build any other kernel module. For example if you have a Silex WiFi module, you’ll have to build it’s driver as follows:

~/$ git clone https://github.com/boundarydevices/qcacld-2.0.git && cd qcacld-2.0
~/qcacld-2.0$ export CONFIG_CLD_HL_SDIO_CORE=y
~/qcacld-2.0$ git checkout boundary-LNX.LEH.4.2.2.2-4.5.20.034
~/qcacld-2.0$ make -j8
~/$qcacld-2.0 make modules_install
~/qcacld-2.0$ cd ..

You don’t have to build the above Silex  module on Ubuntu Trusty, but only on Ubuntu Xenial or Debian Jessie or Debian Stretch.

Based on the above examples you can build your own kernel modules as well. Fetch your sources to a working directory, set your environment variables and build flags as necessary, then simply run make and make modules_install. The environment variables KERNEL_SRC and  INSTALL_MOD_PATH has already been set earlier, you don’t need to worry about them.

After you have built all modules you wanted you need to refresh the tarball:

~/$ make -C $KERNEL_SRC/ubuntunize targz

3. Merging rootfs with kernel and modules

In this step we will merge the new kernel and modules and the original rootfs to a complete image tarball. I assume that you have already downloaded a Ubuntu or Debian system image from this page:

You have two options to merge the new kernel parts into the image; either on the target or on the host PC.

3.1 Merging on the target

Please create the SD card as usual, as described in the paragraph “Programming the image” in the system image’s blog post.

Then copy the tarball file what you have just created (linux-<version>.tar.gz) to the SD card’s /home directory. Don’t forget to type sync to finish copy. Now insert the card in the target board’s socket, and boot the new system up. After booting please do this:

~/$ sudo apt-get purge linux-boundary-* linux-header-* linux-image-* qcacld-module
~/$ sudo tar --numeric-owner -xf /home/linux-4.1.15-gff461ec-dirty.tar.gz -C /
~/$ sudo update-initramfs -c -k4.1.15-gff461ec-dirty
~/$ sudo apt-get update && sudo apt-get dist-upgrade
~/$ sync && sudo reboot
  1. Uninstall the old kernel first
  2. Extract the new kernel
  3. Create an initrd.img ramdisk
  4. Refresh the system, this is optional, it might take about 15-20 minutes
  5. Reboot

3.2 Merging on the host PC

After extracting, we will mount the tarball on a loop device and we modify it with pbuilder. Let’s see it first, then I explain it in details line by line.

~/$ export ROOTFS_IMG=~/Downloads/20160913-nitrogen-4.1.15_1.2.0_ga-xenial-en_US-mate_armhf.img
~/$ export IMG_MOUNT=/tmp/image-loop && mkdir -p $IMG_MOUNT
~/$ export LOOP_DEV=`sudo losetup -f`
~/$ export UBUNTUNIZE=$KERNEL_SRC/ubuntunize
~/$ export PB_EXEC=sudo pbuilder --execute --configfile $UBUNTUNIZE/.pbuilderrc --no-targz --buildplace $IMG_MOUNT --bindmounts "/tmp $UBUNTUNIZE"
~/$ export KERNEL_REL=`cat $KERNEL_SRC/include/config/kernel.release`
~/$ make -C $UBUNTUNIZE -f Merge.mk prerequisites
~/$ gunzip $ROOTFS_IMG.gz
~/$ sudo losetup -o 1048576 $LOOP_DEV $ROOTFS_IMG
~/$ sudo mount -t ext4 $LOOP_DEV $IMG_MOUNT
~/$ $PB_EXEC -- $UBUNTUNIZE/uninstall-kernel.sh
~/$ sudo cp -a $UBUNTUNIZE/linux-staging/* $IMG_MOUNT
~/$ cp $UBUNTUNIZE/create-initrd.sh.in $UBUNTUNIZE/create-initrd.sh && sed "s,@KERNEL_REL@,${KERNEL_REL},g" -i $UBUNTUNIZE/create-initrd.sh
~/$ $PB_EXEC -- $UBUNTUNIZE/create-initrd.sh
~/$ $PB_EXEC -- $UBUNTUNIZE/apt-upgrade.sh
~/$ sudo umount $IMG_MOUNT
~/$ sudo losetup -d $LOOP_DEV
~/$ pigz $ROOTFS_IMG

Line by line explanation:

  1. Define the downloaded system image. We want to change it’s kernel and add modules and optionally we upgrade the whole system with apt-upgrade. You have to define the filename without the ending .gz or .xz
  2. Define the directory where the system image will be mounted up and we create it in the same step.
  3. Look for the first available loop device.
  4. Define the pbuilder mounting point. When pbuilder invokes chroot, this directory will be mounted up, so the system is able to see and execute the scripts.
    • KERNEL_SRC was defined earlier, in the kernel building section.
  5. Define the repeating part of the pbuilder command, we don’t want to type it again and again.
  6. Define the current kernel release, its needed to create the proper initrd.img in the create-initrd.sh script.
  7. Install prerequisites for the following tasks.
    • Including pbuilder, developer scripts and qemu for armhf emulation.
  8. Extract the gzipped tarball. If the tarball compression was not .gz but .xz then you have to type unxz $ROOTFS_IMG.xz instead.
  9. Set the loop device up at the offset 1048576 of the image file.
  10. Mount the loop device to the image mounting directory. At this moment we can see the content of the partition 1 (at offset 2048 sector : 2048 x 512 = 1048576 ) in that directory. And we can modify it if we want.
  11. Run pbuilder to execute a script inside the chroot. The script will run with qemu arm emulation.
    • This script uninstalls the original kernel packages and qcacld module if they exist, because we are going to replace them.
  12. Copy the new kernel and modules in place.
  13. Create the initrd creator script and we e set the current kernel.release in it.
  14. Run pbuilder to execute a script inside the chroot. This script will create an initrd.img ramdisk.
  15. Run pbuilder to execute a script inside the chroot. This script will run an apt update/upgrade on the system to make it up to date.
    • This is optional, you can skip this step if you want.
    • The qemu arm emulation is somewhat slower than native run on target, and running natively is better anyway, so that is the preferred way.
  16. Finish modifying image so unmount the loop device.
  17. Free the used loop device up. The image has been modified inside the extracted .img file.
  18. Compress the image back to .gz . Of course this is necessray only if you want to move/copy/transfer the image.
    • You can write the image directly to an SD card, in that case compressing is not necessary.
    • We use pigz here, its a gzip compatible compressor, but it makes use of multiple cores, so its much faster at big files than gzip.

I used the $HOME (~) directory as working directory, you can replace it with your preferred working directory. Although I used shell commands, you can easily put these lines in a shell script, or you can convert it to a makefile if you like that better. Check the .sh script files in the ubuntunize directory, those commands will be executed on the system image. Really simple scripts, nothing sophisticated. Feel free to change them for your needs.

If this merging process above looks too long or complicated, you can do this in a simpler way :

~/$ export ROOTFS_IMG=~/Downloads/20160913-nitrogen-4.1.15_1.2.0_ga-xenial-en_US-mate_armhf.img
~/$ make -C $KERNEL_SRC/ubuntunize -f Merge.mk

And that will do the same as above.

Final notes

I hope these tools make it easier for you to customize your environment to match a particular board or application use case, but they’re certainly not a panacea. I’ve added an example script file in the ubuntunize directory, named customize-kernel.sh , you can check it to see a typical using. Check it, modify it for your tasks.

You still need to be careful to match the needs of the image you’re tweaking, and need to align your kernel version and configuration with the O/S image used. This is especially true if you need graphics or video acceleration provided by our GPU and VPU packages.

As always, let us know how/if this works for you.

The post Customizing Ubuntu/Debian kernels on i.MX6/7 boards appeared first on Boundary Devices.

Pyro Yocto Release

$
0
0

A new Yocto 2.3 release, Pyro, is now available for the i.MX series platform from NXP.

For the Impatient

How to Burn

To burn the image file to a sdcard, run this command assuming your sdcard is mounted on /dev/sdc

~$ sudo umount /dev/sdc*
~$ zcat boundary-eval-image-nitrogen6x-pyro.sdcard.gz | sudo dd of=/dev/sdc bs=1M

How to Replicate

This image uses a new “pyro” boundary-bsp-platform that can be used to build images for our boards. Lots of this is identical to what was present in our previous images, although a lot has been improved. This is mostly a clone of fsl-community-bsp-platform with meta-browser, meta-qt5, and meta-boundary added in. There is also a Boundary-Devices-centric setup-environment script with a central download area and cache and some extras to the default local.conf.

Firstly, you’ll need to create the download/cache folders and give r/w access.

~$ sudo mkdir -p /opt/freescale/yocto/imx
~$ sudo mkdir -p /opt/freescale/yocto/sstate-cache
~$ sudo chmod -R 777 /opt/freescale

To build the image, you’ll need these packages installed as well as this repo tool that can be installed like this:

~$ sudo apt-get install repo

Now create your build directory and initialize everything.

~$ mkdir ~/pyro
~$ cd ~/pyro
~/pyro$ repo init -u http://github.com/boundarydevices/boundary-bsp-platform -b pyro
~/pyro$ repo sync

Now setup the environment for building. In this example I’m targeting the nitrogen6x, however nitrogen6x-lite, nitrogen6sx, and nitrogen7 are all also valid MACHINE targets here. Use whatever your platform is. Take a look through those MACHINE configuration files linked, you’ll notice the nitrogen6x MACHINE configuration covers many different boards. The other three configurations cover only one board.

There is a new DISTRO variable which controls what sort of image you’re building. You can see all the fslc-DISTROs here. This variable controls what sort of graphics the image is based on. If the image is X11 based, then you’d select DISTRO=fslc-x11, for wayland you’d select fslc-wayland, xwayland fslc-xwayland and so on.

Our boundary-eval-image is X11 based, so you’ll need to select DISTRO=fslc-x11. Then choose whichever MACHINE is relevant for you.

~/pyro$ MACHINE=nitrogen6x DISTRO=fslc-x11 . setup-environment boundary-eval-image

Now bitbake boundary-eval-image

~/pyro/boundary-eval-image$ bitbake boundary-eval-image

Now after some time this should build the same image as above. The image file will deploy to ~/pyro/boundary-eval-image/tmp/deploy/images/{MACHINE}/boundary-eval-image-{MACHINE}.sdcard.gz. Feel free to tweak and add things as you see fit.

Chromium

Chromium 52.0.2743.76 is available in this image, same version as the previous Yocto release. Even though chrome://gpu states video is hardware accelerated, embedded video such as Youtube is a bit choppy for unknown reasons. Video is much better in Firefox.

chromium-morty

Firefox

Firefox is also available. It’s version is 45.5.1esr.

firefox-morty

Video Input Tests

If you have our ov5640-mipi camera, ov5642 camera, or our HDMI input daughterboard the image includes easy desktop icons to launch tests for the respective hardware.

morty-desktop

Launching the respective video input test will show up on the screen and look like this:

camera-morty

Wifi

The builds include a wifi auto-start script which will connect to any open wireless network, or any secured network that you have configured. To add a wifi network with security, run this command and reboot and your board should automatically connect to the network.

root@nitrogen6x:~# wpa_passphrase <network> <passphrase> >> /etc/wpa_suplicant.conf
root@nitrogen6x:~# reboot

Bluetooth

For products with Bluetooth, you’ll be able to connect using these commands:

root@nitrogen6x:~# echo 0 > /sys/class/rfkill/rfkill0/state
root@nitrogen6x:~# echo 1 > /sys/class/rfkill/rfkill0/state 
root@nitrogen6x:~# hciattach -t 30 -s 115200 /dev/ttymxc2 texas 3000000 flow
Found a Texas Instruments' chip!
Firmware file : /lib/firmware/ti-connectivity/TIInit_7.6.15.bts
Loaded BTS script version 1
texas: changing baud rate to 3000000, flow control to 1
Bluetooth: HCI UART driver ver 2.3
Bluetooth: HCI UART protocol H4 registered
Bluetooth: HCI UART protocol LL registered
Device setup complete
root@nitrogen6x:~# hciconfig hci0 up
root@nitrogen6x:~# hcitool scan
Scanning ...
11:22:DE:AD:BE:EF    Some Device
For Silex: Use this hciattach command instead: hciattach /dev/ttymxc2 qca 1000000 -t30 flow

Silex Module Support

If you have a silex wifi/bluetooth module on your board these images come with that supported. You can also build this module by adding kernel-module-silex and linux-firmware-silex to your image by adding this line to the end of your local.conf file: IMAGE_INSTALL_append += “kernel-module-silex linux-firmware-silex”. This can also be uncommented on this line in the image recipe to add it.

As you can see in the linux-firmware-silex recipe you’ll need access to our git repository to pull and compile that code. Please fill out this form to get access to our private git repositories.

You can also read our blog post about the Silex module.

The post Pyro Yocto Release appeared first on Boundary Devices.

U-Boot v2017.07 for i.MX platforms

$
0
0

We’re glad to release the latest U-Boot v2017.07 with support for all our platforms:

For the impatient

Our build server automatically generates and uploads all the latest binaries to this address:

The README file contains the exact commit ID of this build images.

Also, the up-to-date 6x_upgrade/upgrade.scr U-Boot scripts are included so you can copy all the files directly to the root of your media storage.

For those not sure about which binary to download, here is a quick summary for our boards:

Make sure to re-initialize your U-Boot environment after flashing the new binary in order to leverage the new feature, see flashing procedure.

What’s new?

Wait what, already a new release?

Yes, although there isn’t much to say feature-wise, there is a lot of differences to note with this release!

Goodbye 6x_bootscript!

That’s probably the most noticeable change, this release marks the end of the 6x_bootscript as we know it today.

The reason is simple, 6x_bootscript (formerly 6q_bootscript) was introduced back in 2012 when there was no standard for booting an OS.

Since then, U-Boot included such standard:

The default bootscript name is now boot.scr for any OS which makes much more sense that our 6x_bootscript that wasn’t only for i.MX6x any more.

  • So is boot.scr just a renamed version of 6x_bootscript?

No, not exactly, our previous bootcmd was done manually with our own variable naming convention.

If we want to be standard, we need to change variables to match the new convention.

  • So a new U-Boot won’t be able to boot older OS images using 6x_bootscript?

We still want our customers to have a plug & play experience so we will keep some legacy support of 6x_bootscript which means that older images will boot just fine.

BUT, our goal is to get rid of that legacy support at some point in the future.

  • Any other interesting facts due to that change?

Yes, 2 of them:

  1. The new bootcmd looks for boot.scr/6x_bootscript in different locations now:
    • Both / and /boot/ are looked into
  2. All the bootscripts are now located under their own folder instead of Nitrogen6x one:

Any other noticeable change?

One update is the display support for both Nitrogen6SX and Nitrogen7 which was previously missing.

Then the rest of the changes is mostly a refactoring of the source code.

All our boards share a common architecture, so the idea was to create a common folder containing everything shared across all platforms:

This includes Ethernet PHY initialization, pad control definition and default configuration for DDR & clocks.

Although this refactoring doesn’t change anything for a given platform, it reduces its board file quite a bit.

Build instructions

The usual compilation disclaimers apply for this. It is highly recommended to use the gcc-arm-linux-gnueabihf package available on Ubuntu/Debian.

~$ sudo apt-get install gcc-arm-linux-gnueabihf

First, clone our U-Boot git repository. This is the branch you’ll need to compile and install to work with the new kernel.

~$ git clone https://github.com/boundarydevices/u-boot-imx6 \
    -b boundary-v2017.07
~$ cd u-boot-imx6

Here you’ll need to find and make the relevant defconfig for your board.

If you are using a U-Boot >=2015.07, then at the U-Boot prompt you can type the following to see which defconfig you should build.

=> printenv uboot_defconfig

Otherwise, to see all the defconfigs, use this command and pick the one that is right for you.

~/u-boot-imx6$ find . -name "nit*defconfig"
./configs/nitrogen6_vm1g_defconfig
./configs/nitrogen6q2g_defconfig
./configs/nitrogen6dl2g_defconfig
./configs/nitrogen6s1g_defconfig
./configs/nit6xlite_defconfig
./configs/nitrogen6q_fl_defconfig
./configs/nitrogen7_defconfig
./configs/nitrogen6q_som2_2g_defconfig
./configs/nitrogen6sx_defconfig
./configs/nitrogen6dl_defconfig
./configs/nitrogen6q_defconfig
./configs/nitrogen6s_defconfig
./configs/nitrogen6_lum_dl1_defconfig
./configs/nitrogen6_vm_defconfig
./configs/nitrogen6q_som2_1g_defconfig
./configs/nitrogen6q_som2_4g_defconfig
./configs/nit6xlite1g_defconfig
./configs/nitrogen6qp_max_defconfig
./configs/nitrogen6_max_defconfig

 Now compile that defconfig, here I’ll use nitrogen6q_defconfig as an example.

~/u-boot-imx6$ export ARCH=arm
~/u-boot-imx6$ export CROSS_COMPILE=arm-linux-gnueabihf-
~/u-boot-imx6$ make nitrogen6q_defconfig
~/u-boot-imx6$ make -j2

Flashing procedure

Now you’ll have a u-boot.imx file compiled. The copy_upgrade.sh can be used to rename the u-boot.imx file to u-boot.{uboot_defconfig} and move that and the upgrade scripts to the root folder of your media (SD Card / USB / SATA drive).

~/u-boot-imx6/$ ./copy_upgrade.sh <mount_path>/

Plug your media to the platform, power up the board and interrupt u-boot to run the commands below.

If your u-boot prompt is “U-boot >” then you need to set uboot_defconfig to the value that matches your platform.

Here is an example for Nitrogen6x/BD-SL-i.MX6:

Hit any key to stop autoboot:  0 
U-Boot > setenv uboot_defconfig nitrogen6q
U-Boot > run upgradeu

Otherwise just run:

Hit any key to stop autoboot:  0
=> run upgradeu

This will run the 6x_upgrade or upgrade.scr script and look for a file u-boot.${uboot_defconfig} and burn it. At this point it might be worth while to clear your environment variables, this will set you up with the default environment variables and no more.

Hit any key to stop autoboot:  0 
=> env default -a
=> savee

Then as a final note, if you’ve somehow managed to brick your board through this process and need help. Well, we already wrote a blog post here about that topic.

The post U-Boot v2017.07 for i.MX platforms appeared first on Boundary Devices.

Buildroot 2017.08 for i.MX platforms

$
0
0

Buildroot 2017.08 has just been released and we’re glad to provide new images for it.Buildroot

This release brings some new features that will be discussed in this blog post as well as some news of our own.

For the impatient

You can download pre-built Buildroot 2017.08 images from here:

The images can be restored using zcat and dd under Linux:

~$ zcat br2017.08-nitrogen*.img.gz | sudo dd of=/dev/sdX bs=1M

For Windows users, please use Alex Page’s USB Image Tool.

What’s new?

Buildroot 2017.08 new features

This release brings its usual series of improvements:

  • Toolchains are now using GCC6.x by default
  • Binaries in $(TARGET_DIR) are now cleaned up from invalid RPATH

Many new/interesting packages were introduced:

  • azure-iot-sdk-c, libressl, linuxptp, qt5virtualkeyboard, etc…

But the most important improvement in our opinion is the ability to create a relocatable SDK.

This feature is very useful for customers that want their app team not to have to deal with a BSP. The SDK allows anyone to cross-compile any application meant for this rootfs image by leveraging all the libraries available in this latter. This new feature will be detailed in a section below.

For a more exhaustive list of change, here is the full release announcement:

Note that our Nitrogen platforms are all supported in mainline Buildroot. Their configurations for this release include:

Boundary Devices external layer

As mentioned in our Buildroot Getting Started Guide, Buildroot now allows to have custom packages/defconfigs inside an external repository.

Since we’ve had many requests on how to replicate the Buildroot demo images in the past, it was time for us to create our own external layer.

This layer includes:

  • defconfig files for the images above (gst1, qt5 and many useful tools)
  • BD-SDMAC driver and firmware custom packages
  • Custom boot scripts to have ADB support by default
  • Mainline kernel defconfig with Etnaviv/CODA support

This is the first release of this external layer so to let us know if you think some other packages/conf should be added.

External layer configuration details

Here are some details about the configurations available:

NBBD-SDMAC firmware package is commented out in the defconfig files since it requires access to our private git server. Make sure to un-comment it once the access is granted.

Build procedure

  1. Download the latest Buildroot tree:
~$ git clone https://git.busybox.net/buildroot -b 2017.08.x
  1. Download Boundary Devices external layer:
~$ git clone https://github.com/boundarydevices/buildroot-external-boundary -b 2017.08.x
  1. Create an output folder for your build:
~$ make BR2_EXTERNAL=$PWD/buildroot-external-boundary/ -C buildroot/ \
  O=$PWD/output nitrogen6x_qt5_gst1_defconfig
~$ cd output
  1. Build the image:
~/output$ make
  1. Your rootfs image is ready!
~/output$ ls -l images/sdcard.img
~/output$ sudo dd if=images/sdcard.img of=/dev/sdX bs=1M

Testing the image

As usual, the login for this image is root with no password.

The external repository README details many commands that can be tested on the image.

Our Wiki is also a good source of information to get started with Qt5 or GStreamer.

Qt5.9 Cinematic Demo

Qt5.9 Cinematic Demo

Creating/Using an SDK

As mentioned previously, this release allows to create an SDK that can be relocated anywhere.

Here is a link to the SDK for the images above:

Creating the SDK is very simple:

~/output$ make sdk
~/output$ cd host
~/output/host$ tar czf br2017.08-sdk-nitrogen-20170904.tar.gz *

Then it can be provided to all the teams / 3rd parties that need to develop on the platform:

~$ mkdir -p ~/sdk-buildroot-2017.08
~$ cd ~/sdk-buildroot-2017.08
~/sdk-buildroot-2017.08$ tar xzf ~/Downloads/br2017.08-sdk-nitrogen-20170904.tar.gz
~/sdk-buildroot-2017.08$ ./relocate-sdk.sh

The relocate-sdk.sh script is necessary to adjust the path to the SDK new location.

From there, the developer can build any software that leverages the libraries included in the OS image.

The toolchain in this SDK therefore has its sysroot properly setup:

~/sdk-buildroot-2017.08$ ./bin/arm-linux-gnueabihf-gcc -print-sysroot
/home/<user>/sdk-buildroot-2017.08/arm-buildroot-linux-gnueabihf/sysroot

As an example, here is the procedure for cross-compiling imx_usb_loader tool for the target.

It is important to note that imx_usb_loader relies on libusb and its Makefile uses pkg-config.

~$ git clone https://github.com/boundarydevices/imx_usb_loader.git
~$ cd imx_usb_loader
~/imx_usb_loader$ CC=~/sdk-buildroot-2017.08/bin/arm-linux-gnueabihf-gcc \
  PKG_CONFIG=~/sdk-buildroot-2017.08/bin/pkg-config \
  make

You can even use that SDK with QtCreator by following the procedures below:

 

As always, let us know your experiences (both good and bad) when you test out this image.

The post Buildroot 2017.08 for i.MX platforms appeared first on Boundary Devices.

Debian Stretch 9.2 for i.MX6/7 boards – October 2017 (kernel 4.1.15)

$
0
0

 

Debian Stretch 9.2 – XFCE4 Desktop

As it happens every other year, Debian released a new version of its distribution named Stretch. We are glad to offer new images for i.MX6/7 boards with the current 4.1.15 kernel.

As earlier, we used XFCE4 desktop since it offers the best trade-off speed/size for Debian GUI desktop environment. As usual, a console image is also available for those who don’t need a GUI desktop.

This time we also created an other GUI desktop image without the demo applications.

These systems contain NXP/Freescale licensed content, so you will need to register on our web-site and log in before you can accept the license agreement and download the images from here:

Important !

Before installing this image please check your U-Boot version. The 4.1.15 kernel requires U-Boot version 2015.07 or higher, U-Boot version 2017.07 is recommended. You can find the bootscript in the /boot subdirectory now, its named boot.scr . The partition labels are set if you use dd or ddrescue to create the disk. If you use your own method please check the boot partition labels, because the fstab boots by label (LABEL=sys-16h for example) now. You can use ext2label to modify partition label.

Programming the image

The image is a slightly-less-than-4GiB image file containing the partition table.  Inspired by ubuntu-mate.org, I changed over from dd to another disk copy program called ddrescue. It is a much more talkative program, although dd does do it’s job honestly. I don’t like mute programs, you never know whats happening in a given moment. For example, if you want to create an SD card for a console image, you need to do the following :

$ sudo apt-get install gddrescue xz-utils util-linux
$ gunzip 20171018-nitrogen-4.1.15_2.0.0_ga-stretch-en_US-devcon_armhf.img.gz
$ sudo ddrescue -D --force 20171018-nitrogen-4.1.15_2.0.0_ga-stretch-en_US-devcon_armhf.img /dev/sdX

You have to replace sdX with your actual SDHC reader/writer device. Use the lsblk command to check it.

Type lsblk with unplugged SDHC reader, then insert the device, and type lsblk again. A new node will be added , that is your SDHC reader/writer device.

Usernames and passwords

Two users are defined for use on the system: debian and root. The password for each is Boundary (capital B).

An ssh server is configured on the system, though it does not allow password-based authentication for user root.

User debian has sudo privileges, so you can place your ssh public key (normally $HOME/.ssh/id_rsa.pub) to the system like so :

debian@nitrogen:~$ sudo mkdir /root/.ssh
[sudo] password for debian:
debian@nitrogen:~$ sudo nano /root/.ssh/authorized_keys
... paste content of $HOME/.ssh/id_rsa.pub here
debian@nitrogen:~$ sudo chmod 600 /root/.ssh/auth*
debian@nitrogen:~$ sudo chmod 600 /root/.ssh/

What’s supported

Since the images above include our stable 4.1.15 kernel, essentially everything is supported including :

  • Vivante GPU accelerations
  • C&M VPU accelerations
  • Wi-Fi and Bluetooth modules for Tiwi-BLE, BD_BCOM, BD-SDMAC
  • All kind of storage devices , SDHC card, eMMC, SATA hdd, USB pen sticks, cell modems
  • All of our supported touch panels
  • IMX Capture devices including OV56xx parallel and mipi cameras, Toshiba BD-HDMI-MIPI converter, UVC cameras
  • It supports i.MX6Q/DL/SX and i.MX7D board’s BSP

The packaging (inluding kernel) is done in the normal debian way, so apt-get update/dist-upgrade will keep your image up and running the latest as patches come out.

What’s new in this release

  • The Linux kernel was upgraded to 4.1.15 ( meta-package name: linux-boundary-12s )
  • GPU driver was upgraded to Vivante 6.2.2p0 ( meta-package name: imx-gpu-viv-s13-… ).
  • The module galcore (CONFIG_MXC_GPU_VIV) was removed from the kernel, and it’s an externally built module. This change makes the graphics system modular, and more upgradeable, at the price of longer kernel upgrading time. Upgrading kernel takes about 3-4 minutes now, instead of 30 seconds, because every kernel upgrade rebuilds the galcore driver from sources, because its a DKMS module.
  • The package gstreamer-imx was upgraded to 0.12.3-5
  • The new NXP/Vivante GPU SDK was added : imx-gpu-sdk 4.0.2 . You can get the source with the usual apt-get source command. This is a brand new SDK with many new demos, for example OpenCL, OpenVG,G2D, and for OpenVX and Vulkan, but those demos will be supported only by the i.MX8 SoC.
  • The distribution was upgraded to Stretch 9.2 . Here are some main component versions :
    • Xorg server 1.19.2
    • gstreamer1.0 1.10.4
    • bluez 5.43
    • Qt5 5.7.1
    • apt 1.4.8
    • chromium 59.0.3071.86-1
    • dpkg 1.18.24
    • gcc/g++ 6.3.0
    • firefox-esr 52.2.0esr
    • libwayland 1.12.0
    • weston 1.11.0-1
    • XFCE Desktop Environment 4.12.3
  • The desktop icon structure is similar to Ubuntu now, the demo icons are grouped in the same way.
  • Silex WiFi / Bluetooth is now supported in Stretch also, not only in Xenial and Jessie.

 


Let’s see some interesting new demos,  this is a screen of the imx-gpu-sdk OpenGLESv2 Blur demo, a spinning bubble with environment mapping:

IMX GPU SDK 2.2.2 Gaussian Blur demo

IMX GPU SDK 4.0.2 Gaussian Blur demo

You can find many other interesting samples and framework in the SDK, including GLESv2, GLESv3, OpenCL, OpenVG.


This Qt5  Qml demo below shows how to apply various effects on a running video stream, using GPU shaders :

Qt 5.7.1 Cinematic Experience demo

Qt 5.7.1 Cinematic Experience demo

You can apply various effects on a playing video and/or recording camera screen . Source is available.


Chromium browser now supports WebGL. This is an example from the web:

Chromium WebGL demo

Chromium WebGL demo

 

GPU development libraries

The package imx-gpu-viv-s13-dev ( development headers and libraries for OpenGL / ESv2 / ESv3 / Khronos / OpenVG / OpenCL /G2D ) is installed by default. You have to set the headers path, before any other headers, or you might include the mesa headers first, and you don’t want to do that. For example :

export CFLAGS="-I/usr/include/vivante ${CFLAGS}"

and you have to set the library path as well :

export LDFLAGS="-L/usr/lib/arm-linux-gnueabihf/vivante ${LDFLAGS}"

Alternatively you can use the much more precise pkg-config way, in the makefile. Setting the flags in case of X11 system :

PKG_CONFIG_PATH = /usr/lib/arm-linux-gnueabihf/vivante/pkgconfig

EGL :

CFLAGS += $(shell pkg-config --cflags egl_x11)

LDFLAGS += $(shell pkg-config --libs egl_x11)

GLESv1 :

CFLAGS += $(shell pkg-config --cflags glesv1_cm_x11)

LDFLAGS += $(shell pkg-config --libs glesv1_cm_x11)

GLESv2 :

CFLAGS += $(shell pkg-config --cflags glesv2_x11)

LDFLAGS += $(shell pkg-config --libs glesv2_x11)

OpenVG :

CFLAGS += $(shell pkg-config --cflags vg_x11)

LDFLAGS += $(shell pkg-config --libs vg_x11)

In case of FB backend change the _x11 postfix above to _fb, thats all.

OpenCL is the same at both fb and x11 :

CFLAGS += $(shell pkg-config --cflags opencl)

LDFLAGS += $(shell pkg-config --libs opencl)

Check the directory /usr/lib/arm-linux-gnueabihf/vivante/pkgconfig for more information


 

As always, please give us some feedback and let us know how things work for you.

The post Debian Stretch 9.2 for i.MX6/7 boards – October 2017 (kernel 4.1.15) appeared first on Boundary Devices.

Viewing all 391 articles
Browse latest View live